Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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... :(

like image 298
user7024499 Avatar asked Nov 04 '16 00:11

user7024499


1 Answers

Create-React-App has a detailed documentation on how to deploy your build to Github Pages and Heroku. You can read it here. Your specific issue is covered in "Notes on client-side routing" section.

like image 153
Khang Lu Avatar answered Sep 20 '22 16:09

Khang Lu