How to install Node.JS and NPM on any Raspberry Pi

As you probably know Raspberry Pi's official image doesn’t come with node pre-installed on the system and that’s normal.

If you would like to install node.js and npm you will have to follow these simple steps.

First of all, you will need to have Linux installed on the SD card. If you don’t know how to do this you can follow the instructions from this article.

Install Node.JS

To install node.js first you should check what type of ARM chip you have. The ARM chipset it’s different from one Raspberry model to another so you can’t go with the same steps on all the Raspberry models.

These are the ARM chipset versions by Raspberry Pi model:

  • ARM8: all RPi 4, all RPi 3, RPi 2 Model B v1.2
  • ARM7: RPi 2 Model B
  • ARM6: all Zero, all RPi 1

Or you can run in your terminal this command to find it out:

uname -m

If this returns something starting with armv6 you will need to install node.js for ARMv6

Now go to node.js download page and download the Linux Binaries (ARM) for your ARN version.

ARMv8:

wget https://nodejs.org/dist/v10.16.1/node-v10.16.1-linux-arm64.tar.xz

ARMv7:

wget https://nodejs.org/dist/v10.16.1/node-v10.16.1-linux-armv7l.tar.xz

ARMv6:

wget https://nodejs.org/dist/v10.16.1/node-v10.16.1-linux-armv6l.tar.xz

After that unzip it.

Make sure to change the filename to the one based on your version that you have downloaded. Below is the version for ARMv8, I will not add all the 3 versions because they are the same steps, only the name of the directory is different.

tar -xJf node-v10.16.1-linux-armv6l.tar.xz

Copy node to /usr/local

cd node-v10.16.1-linux-armv6l/
sudo cp -R * /usr/local/

Check if node and npm are installed correctly. These lines should print the version of node and npm installed.

node -v
npm -v

Now you have node.js and npm installed on your Raspberry Pi and working.

node and npm versions

Thanks to Dani Dudas

https://medium.com/@danidudas/how-to-install-node-js-and-npm-on-any-raspberry-pi-5a82acdfeefc