0

I've forked this repository and then proceeded to build and deploy it as suggested but I cannot start correctly the web site.

The passes I've followed are:

  1. git cloned the repo
  2. Moved in the folder and executed without any problem: npm install -g yarn
  3. Executed: yarn
  4. Executed: npm install -g gatsby-cli
  5. Executed: npm install
  6. Executed: gatsby build
  7. Executed: npm run deploy where deploy is defined as: gatsby build && gh-pages -d public -b gh-pages

These commands correctly build the project and create a new branch on the repository with the public folder which is the build foledr.

My repository is configured to use GitHub pages like this:

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks. I should've changed the deploy script in some way to allow it to generate index with different paths, I solved the problem by making my repository a user repository, in that way it automatically didn't include the repository name and the resource are exactly where he wants.
@SimoneLungarella what exactly you did to make your repository as a "user repository" on GitHub ?
I'm not really sure right now but should be enough calling the repository: username.github.io

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.