Patrick Kelly
Patrick Kelly

Reputation: 63

Create-React-App on Github-pages returns a blank page

When testing locally my create-react-quiz app works perfectly. I was basing my project off of this code: https://github.com/mitchgavan/react-multi-choice-quiz/tree/gh-pages.

However, when I use npm build deploy on my "GitHub-Pages" branch, a blank page shows up and these errors show up in the console: pk8189.github.io/:1 GET pk8189.github.io/pk8189/futureU-/static/css/main.1dc4d41f.css pk8189.github.io/:1 GET pk8189.github.io/pk8189/futureU-/static/js/main.28e294a0.js

This is my repo: https://github.com/pk8189/futureU- What do you think the issue is? Thank you for any help.

Upvotes: 6

Views: 5767

Answers (1)

Dan Abramov
Dan Abramov

Reputation: 268255

Create React App uses homepage field in your package.json to determine the URL at which the app is served. Since you set it to https://github.com/pk8189/futureU-/, it tries to request assets from /pk8189/futureU-/ which doesn't exist.

Change homepage to match your deployed URL: https://pk8189.github.io/futureU-/. Then rebuild by running npm run build and re-deploy.

This is described in deployment instructions for GitHub Pages. Please read this part of the User Guide.

Upvotes: 11

Related Questions