0

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"
    ]
  }
}

2 Answers 2

1

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",
    ...
Sign up to request clarification or add additional context in comments.

4 Comments

What deploy script are you referring to? The branch created by npm run deploy is gh-pages, in the package.json and I checked it is on the gh-pages branch in the settings of my github repo
I've clarified in my answer for you.
Do you know why it needs this? Other tutorials I've found online don't mention this either.
I wish I could tell you but I don't know. It's just something that I read about recently to deploy my portfolio site using Gatsby but don't recall where.
0

Where is your static folder in your repo? This is what your 404 page is complaining about it. I checked your GitHub repo and I don't see either.

1 Comment

I don't know? If I do a new create-react-app there is no static folder either...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.