Script loading in local test environment but not on GitHub

I uploaded my Markdown Previewer to my GitHub repo and it doesn’t wanna load the script for the marked library.

I first had this problem locally but I solved it by adding the marked library using my command line inside VS Code.

I then added the script that points to the location of my marked lib and everything was working fine: <script src="./node_modules/marked/lib/marked.js"></script>

And now I uploaded my code to GitHub repo and it doesn’t wanna load the script.

Here is a link [GitHub - Gamintor/]


So when inspecting the deployment (with Chrome), I noticed that in sources, the no_modules folder was not loaded. Hence, the 404 error on marked.js. A short google search lead me to this stackoverflow answer… Forked from your repo to test it out and it works!
Happy coding!

In case the link to the stackOverflow answer gets broken - long story short, Github pages now runs a version of Jekyll that ignores the node_modules folder (by default) and you can fix it by adding an empty .nojekyll file to the root folder :slight_smile:

1 Like

It never came to me that I should look into the sources tab to see that the node modules is not loaded. I only looked inside console.

Thanks a lot!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.