Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.
Ben Nadel at the New York ColdFusion User Group (Feb. 2009) with: Joakim Marner and Clark Valberg
Ben Nadel at the New York ColdFusion User Group (Feb. 2009) with: Joakim Marner and Clark Valberg@clarkvalberg )

Including node_modules And vendors Folders In Your GitHub Pages Site

By Ben Nadel on

CAUTION: This post is mostly a note-to-self, for Future Ben.

Yesterday morning, I woke up, pushed a new demo to my JavaScript Demos project on GitHub, and then subsequently found out that every single one of my demos was broken. Apparently GitHub started using Jekyll 3.3.0 to power GitHub pages (which is how I render my demos on a gh-pages branch). This version of Jekyll ignores the "vendor" and "node_modules" directories by default, which is why all of my demos were broken. You can override this behavior, but doing so was not obvious to me.

First, I want to give a huge shout-out to Eric McCormick, Erik Zaadi, and Bill Rawlinson who watched me panic on Twitter and then helped me to regain my composure.

According to the GitHub blog post, you can add a _config.yml file to tell Jekyll to "include" the "node_modules" and "vendors" directories. I don't know anything about Jekyll (or even that this is what was powering GitHub Pages); so I tried creating a _config.yml file. To no avail. Nothing changed.

Apparently, according to the GitHub support ticket I opened, _config.yml only works if you're actually using Jekyll in your GitHub Pages branch:

Hey Ben,

Sorry for the confusion here.

We recently moved to Jekyll 3.3. which ignores the "vendors" folder by default.

A _config.yml file will only work if you are using Jekyll, so the .nojekyll is your best bet.

Since I'm not using Jekyll - since I thought GitHub pages was just "HTML" - I created an empty .nojekyll text file in the root of my gh-pages branch. And kablamo! It started working again!

Future Ben, you're welcome.

Looking For A New Job?

Ooops, there are no jobs. Post one now for only $29 and own this real estate!

100% of job board revenue is donated to Kiva. Loans that change livesFind out more »

Reader Comments

Thank you thank you thank you! This is the only resource on this issue I could find. Adding the empty .nojekyll file worked!

Reply to this Comment

Thank you very much. You are a savior. I was trying the service worker and faced the node_modules issue which consumed a lot of time. The .nojekyll worked and could find the solution only here. Thanks a lot again. Salute from India.

Reply to this Comment

I am extremely happy to see my project up and running on the server because of your solution. Thank you very much Ben!

Reply to this Comment

Post A Comment

You — Get Out Of My Dreams, Get Into My Comments
Live in the Now
NEW: Some basic markdown formatting is now supported: bold, italic, blockquotes, lists, fenced code-blocks. Read more about markdown syntax »
Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.