'Github pages shows blank page
My repo: https://github.com/jmrocco/personal_website My website: https://julietterocco.com/
I can not figure out why my GitHub pages can’t load any of my source files. The files I want to load are in the src folder. Everything works as it should on localhost. It only loads index.html which is a white blank screen, I don't have anything coded in this file. I’ve seen a few similar posts about this issue but have not found any common discrepancies.
I have installed through npm the gh-pages module and done “npm run deploy”; this created my gh-pages branch. I’ve updated my package.json with the appropriate information. As far as I can tell I have no capital letters in my repository.
I hosted another website previously on Github Pages at this domain with no issues. It appears that Github pages and the process has changed since then and I can’t get it to work.
Solution 1:[1]
The problem is that your homepage is trying to load assets from https://julietterocco.com/personal_website/static/js/main.3edbf089.chunk.js rather than https://julietterocco.com/static/js/main.3edbf089.chunk.js.
Remove the personal_website
extension from homepage
in package.json
and the routes should work properly.
Therefore your new package.json
should look like:
{
"homepage" : "https://jmrocco.github.io/",
"name": "my-website",
"version": "0.1.0",
...
Solution 2:[2]
Make sure that your package.json contains
"homepage": "https://username.github.io/appname"
If you are using BrowserRouter, set the basename:
<BrowserRouter basename={process.env.PUBLIC_URL}>
Your .env file cannot contain something like
PUBLIC_URL=/
when you do a deploy (it was the problem in my case)
Solution 3:[3]
Adding "homepage": "https://myusername.github.io/my-app", to your Package.JSON might solve your problem.
remember replace your github user name and your app name.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Robbie JW |
Solution 2 | Micha? Skwara |
Solution 3 | Pierre.Vriens |