Install Node.js on your raspberry pi

This guide is very short and will help you get Node.js installed on your raspberry pi. Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. This website is actually hosted via a Node.js server.

Things you need before we start

  • Raspberry Pi (setting one up can be done this way)
  • A few minutes of your day :)

Make sure your pi is up to date!

Run these two commands to insure you have the latest OS updates: sudo apt-get update; sudo apt-get upgrade
This may take a few minutes, but any time you want to install new software you should really do this first.

Which version to download?

On your raspberry pi, run this command: uname -m
You will see something like: armv6l (this is arm v6 which is used in the raspberry pi zero w)

Download Node.js on your pi

Now that you know which version you will need go to the node.js download page.
Next: Right-click the version you need (I will get ARMv6 for my pi zero w) and select "copy link address".


After you have the link copied to your clipboard, you need to go to your pi and type "wget " and past the link. Then, change the last two characters from .xz to .gz

					//Do not forget to change the last two characters from xz to gz
wget https://nodejs.org/dist/v10.15.1/node-v10.15.1-linux-armv6l.tar.gz
				

Install Node.js

Node.js is now on your pi and all you need to do is extract the file you just downloaded:

					//Do not forget to change the last two characters from xz to gz
wget https://nodejs.org/dist/v10.15.1/node-v10.15.1-linux-armv6l.tar.gz

//Extract the file you just downloaded:
tar -xzf node-v10.15.1-linux-armv6l.tar.gz

//Cd into the directory
cd node-v10.15.1-linux-armv6l

//Cop to your /usr/local directory
sudo cp -R * /usr/local/
				

It's installed!

Let's just double check that it is really there:

					//Display the current version of node installed
node -v

//Output
v10.15.1

//Display the current version of npm - the node package manager
npm -v 

//Output
6.4.1
				

You should be good to go! You can clean up your installation by removing the downloaded files:

					cd ~
rm -rf node-v10.15.1-linux-armv6l.tar.gz node-v10.15.1-linux-armv6l