Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github Pages 404 on node_modules folder

I am trying to render my GitHub repo on the Publisher-Subscriber module with JavaScript using GitHub pages. The gh-pages branch looks fine. However, the mustache code does not render on my project on GitHub Pages. It looks like this :

enter image description here

GitHub Repository : https://github.com/ajhalthor/pubsub-application

Github Pages Repo for this project : https://ajhalthor.github.io/pubsub-application/

The GitHub Repository also has the node_modules folder, so it should be self sufficient. Mustache, jQuery & Bootstrap are included in this folder, so there are no external links or CDNs.

Main Question : Why isn't mustache rendering even though all paths are specified relative to the project's main folder?

like image 975
Ajay H Avatar asked Apr 18 '17 20:04

Ajay H


People also ask

Why is my GitHub Pages 404?

If you saw 404 even everything looks right, try switching https/http. The original question has the url wrong, usually you can check repo settings and found the correct url for generated site.

How do I fix a 404 File Not Found in GitHub?

Solution: Verify the publishing source and published URL from your repository's settings tab. Double check that you are using the correct URL by visiting your repository's Settings, and scrolling down to the GitHub Pages section. You should see the URL where your site is published.

Should I check my node_modules folder into Git?

Not committing node_modules implies you need to list all your modules in the package. json (and package-lock. json ) as a mandatory step. This is great because you might not have the diligence to do so, and some of the npm operations might break if you don't.

Should node modules be uploaded to GitHub?

For reference, npm FAQ answers your question clearly: Check node_modules into git for things you deploy, such as websites and apps. Do not check node_modules into git for libraries and modules intended to be reused. Use npm to manage dependencies in your dev environment, but not in your deployment scripts.


1 Answers

Github pages uses a version of Jekyll that ignores node_modules folder by default.

According to this blog article. You can do the following:

Create an empty .nojekyll text file in the root of the gh-pages branch.

You can also refer to this announcement by github which talks about the update that is responsible for this behavior.

like image 107
majidarif Avatar answered Oct 01 '22 04:10

majidarif