Github Pages Resource 404

Viewed 58

As of now I want to publish my payment gateway website to GitHub pages but after running all the commands like npm run build as well npm run deploy my page has been published but on GitHub pages it is showing error for resource:

enter image description here

Here is how it looks in my IDE: enter image description here

1 Answers

You published your website on a subpath like xyz.github.io/mysubpath but the references on the index page (according to the page source) are absolute to the root.

This is even shown in the console output:

The project was built assuming it is hosted at /.

If you cannot move your website to the root, you need to adjust the paths to be either relative (remove the first slash) or include the subpath (e.g. /mysubpath/favicon.ico). The framework you are using probably has a way to set the basepath or homepage.

From the screenshot of your IDE, I see that you seem to use React and therefore can probably change line 2 to homepage instead of home. Additional information can be found here.

Related