React-router issues with deploying github pages, with create-react-app

user7024499 picture user7024499 · Nov 4, 2016 · Viewed 18.1k times · Source

I am having the hardest time deploying a simple react application to github pages. You move one file to a wrong directory and it throws the entire process off.

What do I do once I run npm run build?

That puts all my files into a build folder, but the browser still keeps giving me 404 errors, thinking that anything typed after the initial url route's "/" is looking for an actual file from a server. I just want to use whatever comes after the / as routes that I set up in my React Router... :(

Answer

Khang Lu picture Khang Lu · Nov 4, 2016

Create-react-app has a detailed section on how to deploy your build to Github Pages and Heroku. You can read it here