0

Hi I'm trying to deploy my reactjs app to GitHub pages but I keep getting a blank page here are the steps I followed

  1. Pushing project to empty repo: https://github.com/DroidBarber/dolla

  2. installing gh-pages: npm install gh-pages --save-dev

  3. modifying package.json :

{
"homepage": "https://DroidBarber.github.io/dolla/",
},
scripts": {
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
},
  1. deploying npm run deploy

but I'm getting a blank page app runs fine in local host...

Help...

DroidBarber
  • 35
  • 1
  • 9

2 Answers2

0

GitHub Pages doesn't support the pushState history API (which react-router-dom's BrowserRouter uses under the hood). You'll need to switch to HashRouter instead. You can read more about it here

Keith Brewster
  • 3,302
  • 2
  • 21
  • 28
0

You are deploying your application to an additional path: /dolla/. So when your deployed react application run on: https://DroidBarber.github.io/dolla/ it tries to get resources from /dolla/ which is not defined in your routing. See pathName

It will be similar when you run on your local at http://localhost:3000/dolla

Try to change your homepage in webpack to: "homepage": "https://DroidBarber.github.io/".

Ryan Le
  • 7,708
  • 1
  • 13
  • 23