How to add Node.js & npm to jekyll in GitHub Codespaces

Published on

You can use GitHub CodeSpaces to develop your Jekyll site. But you need to install Node.js and npm to use e.g. TailwindCSS.

So, if you haven’t already, create a file called devcontainer/devcontainer.json in your repository, with the following content:

{
  "name": "Jekyll",
  "image": "mcr.microsoft.com/devcontainers/jekyll:0-bullseye",
  "features": {
    "ghcr.io/devcontainers/features/node:1": {
      "version": "latest"
    }
  }
}

This will start from the image “mcr.microsoft.com/devcontainers/jekyll:0-bullseye” and also add Node.js and npm.

Now, when you open your repository in GitHub Codespaces, you can use Node.js and npm.

For more information about the “features” property, see devcontainer.json reference.

Here, have a slice of pizza 🍕