Installing node.js

Now that you are connected to your Pi via SSH, you can move on to installing the latest stable version of node.js.

Adding the Package Repository

The first step will be to add the NodeSource package repository to your Pi's /etc/apt/sources.list file. You can do this by running the following command.

Download: file
curl -sL https://deb.nodesource.com/setup_10.x > nodesetup.sh

# It's a good idea to inspect scripts before you run them:
nano nodesetup.sh

sudo bash nodesetup.sh
sudo apt-get install -y nodejs

Next, we will install the latest version of node.js using apt-get.

Download: file
sudo apt-get install -y nodejs

If everything went as expected, we can check the installed version of node.js by running node -v.  At the time of this writing, the latest stable version of node.js was v10.11.0.

Download: file
[email protected] ~ $ node -v
v10.11.0

Now that we have node.js installed, we can look at the strengths of node.js development on a Raspberry Pi.

This guide was first published on Dec 19, 2014. It was last updated on Dec 19, 2014. This page (Installing node.js) was last updated on Oct 09, 2018.