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.