-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gh-pages deployment problems with react-router #1765
Comments
The
But your project is on Two solutions:
In the future, we might flip the development server to also take Hope this helps! |
Worked perfectly using Thanks for the help! |
@rockchalkwushock After you figure out, would you mind sending a PR to User Guide to make this experience better for the next person? |
@gaearon sorry for the late response I never got a notification on this. Sure thing I will try and do so this evening. |
Thank you so much for the solution @gaearon |
I know I am a bit late here but the <BrowserRouter basename={process.env.PUBLIC_URL}>
{/* routes */}
</BrowserRouter> |
+ set up Github Pages deployment (see: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#github-pages) + index.js: add basename so the app works correctly on Github Pages. (see: facebook/create-react-app#1765 (comment))
@willdurand your solution is (for react-router users) is the best one. You should make a PR to User Guide for it |
gh-pages is served on .../nwhacks2019, which will mess with react-router: facebook/create-react-app#1765
If anyone got here via searching for For any Link element, prefix the route: <Link to={process.env.PUBLIC_URL + '/'}> Likewise for Route's: <Route path={process.env.PUBLIC_URL + '/'}> |
None of the suggestions here worked for me (using a custom domain). But I finally found this, which worked for both Netlify and gh-pages: I just needed to change the build script to copy the
Hope this helps someone else out there. |
@nathanchapman Yay!!! I've been searching for hours and this is the only thing that's worked! Thanks |
Added
react-router
and just aHome
page andPage404
to the router. When I navigate to the declaredhomepage: https://rockchalkwushock.github.io/rcws-development/
I am first being directed to myPage404
.I thought that it was possibly because in the router I have 2 paths
/
&*
:Seeing that my
homepage
is pointing to/rcws-development/
I thought perhaps this was the issue; because when I use the redirect button on thePage404
I'm sent tohttps://rockchalkwushock.github.io/
. So I changed myhomepage: https://rockchalkwushock.github.io/
but no such luck. I then get Github's 404.I followed the instructions from the README and went to the following repository after reading that gh-pages does not natively support front-end routing. However I still am first being directed to my
Page404
upon visiting the website.Any ideas why this is? Link to repo
The text was updated successfully, but these errors were encountered: