Home > Enterprise >  Resources not found after deploying with GitHub pages
Resources not found after deploying with GitHub pages

Time:09-18

I've forked GitHub settings

but whenever I open the web site I can only see background color and opening console I see a few errors reaching resources:

Failed to load resource: the server responded with a status of 404 () 
webpack-runtime-b79041fc2b38a6c91c6b.js:1 
Failed to load resource: the server responded with a status of 404 ()
app-8f8fb0f08c61a13c61ac.js:1
[...]

I can correctly make changes to the repository and start it locally with gatsby serve. The only problem I have is with deployment, can someone figure out what's my problem with the info I provided?

CodePudding user response:

Your GitHub Pages Site is published at https://surveiior.github.io/surveiior.com/ and not https://surveiior.github.io/.
So, for example,
You have used /page-data/index/page-data.json in the HTML code, which sends the request to https://surveiior.github.io/page-data/index/page-data.json, but the json file is published at https://surveiior.github.io/surveiior.com/page-data/index/page-data.json.

You can use ./page-data/index/page-data.json or page-data/index/page-data.json in the HTML code and it is where the file is hosted.

In short, to make the file path correct, you can add a .[dot] before the slashes of every address that is showing Error 404, and it will show the correct file if the file path is correct.

  • Related