Skip to content
Advertisement

Deployed React app to github pages is blank

I’m following instructions from https://github.com/gitname/react-gh-pages to deploy my react app to github pages.

At the link I’m getting a blank page though and a 404 error: Failed to load resource: the server responded with a status of 404 ()

My app works on local host

I searched around and its likely my homepage link that is wrong?

link to my repo: https://github.com/PatgioK/pathfindingvisualizer

link to the app: https://patgiok.github.io/pathfindingvisualizer/

here is my package.json:

{
  "name": "pathfindingvisualizer",
  "version": "0.1.0",
  "private": true,
  "homepage": "https://patgiok.github.io/pathfindingvisualizer/",
  "dependencies": {
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "gh-pages": "^3.2.3",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "4.0.3",
    "save-dev": "0.0.1-security",
    "web-vitals": "^1.1.2"
  },
  "scripts": {
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Advertisement

Answer

Try specifying the branch in the deploy script by adding -b SomeBranchName in your packages.json.

so:

"scripts": {
    ...,
    "deploy": "gh-pages -d build -b SomeBranchName",
    ...
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement