Getting Started with 🍦.11ty.js, Part IV: Installing Node.js and Eleventy
This is the fourth post in a five-part series on “Getting Started with 🍦.11ty.js”
👣 Background
By this point, you should have already:
- Installed and configured Git on your computer
- Cloned 🍦.11ty.js from GitLab into your preferred directory
In order to run 🍦.11ty.js in your local development environment, the final tool you’ll need to have installed is a program called Node.js, which also comes with a handy package manager called npm.
What is Node.js?
In the first post of this series, I briefly explained that Node.js is the JavaScript runtime environment which allows you to use 🍦.11ty.js and Eleventy on your computer outside the browser.
I go into more detail on the About page why I think Node.js combined with Eleventy is the one of the best ways to build the web.
If I may reiterate one point, then it is that building the web with Node.js, Eleventy, and 🍦.11ty.js lowers barrier to entry 🚧.
One fewer language to write means one fewer language to learn in order to get started. The Web is for everyone, and we should build websites and applications like we actually believe that. JavaScript is and always has been the native programming language inside the browser. So, it only makes sense to use JavaScript in your local development environment too—Node.js, Eleventy, and 🍦.11ty.js make that possible.
How Do You Install Node.js?
Like Git, there are different ways to install Node.js based on your operating system. Here are what I know to be the clearest, officially supported methods. If you’re interested, the Node.js website lists a few more options.
On 🐧 Ubuntu Linux
Open your terminal and enter the following commands.
1. Check if your computer already has Node.js:
node --version
Even if you already have Node.js installed, it’s still a good idea to update your system so you can access to the latest supported software versions.
2. Update your system:
I recommend running this pair of commands:
sudo apt update
sudo apt -y dist-upgrade
If you already have Node.js installed and you have at least version 12.16.1
(the latest stable release as of this writing), you can skip to installing Eleventy.
3. Install Node.js:
I recommend installing the latest stable release (LTS).
Replace setup_12.x
with the latest major stable release (for example, setup_13.x
if you’re reading this post in the future, but not so far in the future that the latest stable release will have been newer than 13
).
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt install -y nodejs
All that’s left is to install Eleventy.
On 🍏 macOS
Download the macOS Installer directly from nodejs.org and follow the instructions from the installation wizard.
All that’s left is to install Eleventy.
On 🏢 Windows
Download the Windows Installer directly from nodejs.org and follow the instructions from the installation wizard.
All that’s left is to install Eleventy.
Installing Eleventy 🕚
Now that you have Node.js installed, you can use Node’s package manager, npm, to finish installing 🍦.11ty.js, Eleventy, and their dependencies (that is, other smaller programs 🍦.11ty.js and Eleventy need to run).
In your terminal and enter the following command:
npm install
We’ve just gotten started with Node.js. But now that you have all the necessary software installed, we can pick up in the final post of this series with editing and creating your first content with 🍦.11ty.js.