2

I'm trying to deploy a create-react-app to GitHub Pages, but I'm getting a 404.

404

There isn't a GitHub Pages site here.

What I've done:

  • Created a user site repo named <username>.github.io
  • Added "homepage": "https://<username>.github.io" to package.json (as per the Create React App docs)
  • Installed the gh-pages package
  • Added and ran "deploy": "gh-pages -b master -d build" to scripts in package.json

The contents of /build folder is successfully pushed to master, but the site isn't accessible.

The repo's GitHub Pages settings simply says:

Your GitHub Pages site is currently being built from the master branch.

User pages must be built from the master branch.

I also tried some routing solutions (this and this) without making any difference, although I don't think they are ment to fix the problem I'm having.

I'm not sure how to troubleshoot this any further. Any ideas?

1 Answer 1

12

Ok, so apparently you have to choose a GitHub Pages theme (even though you're not using it) in order for the page to be published. This seems very strange to me, and from what I can tell it's not at all mentioned in the documentation. 🤷‍♂️

Sign up to request clarification or add additional context in comments.

2 Comments

This also helped me out: create-react-app.dev/docs/deployment/#github-pages. Has other documentations on Netlify, Heroku, Vercel...

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.