Search code examples
reactjsgithubgithub-pagescreate-react-app

Getting blank page after react app publish in github


My steps are:

npm run build

Then

"homepage": "https://parthaaaaa.github.io/firstwebapp/",

"predeploy": "npm run build",

"deploy": "gh-pages -d build"

in package.json file

Then

npm install --save-dev gh-pages

Then

In Github repository.. I selected gh pages branch

Finally,

npm run deploy

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

Help..


Solution

  • In your package.json homepage is not correct, so it is messing up the build. Change

      "homepage": "https:Parthaaaaa.github.io/firstwebapp",
    

    to

      "homepage": "https://parthaaaaa.github.io/firstwebapp",
    

    Then try building and deploying again.


    Documentation on Building for Relative Paths