Low Orbit Flux Logo 2 F

Raspberry Pi - How To Install Node.js

There exist multiple different ways to install Node.js on a Raspberry Pi. We’re going to cover a few different methods here.

Method 1: Manual - Install Node.js on Raspberry Pi

Check for the link to the latest version: HERE

Pull it down like this ( change the version to whatever is the newest at the time ):

wget https://nodejs.org/dist/v8.9.0/node-v8.9.0-linux-armv6l.tar.gz

Extract it:

tar -xzf node-v8.9.0-linux-armv6l.tar.gz

Copy it into place:

cd node-v6.11.1-linux-armv6l/
sudo cp -R * /usr/local/

Verify that both Node and NPM are working:

node -v
npm -v

Method 2: Add Repo - Install Node.js on Raspberry Pi

NOTE - I have not vetted this repo but it is probably safe. It was mentioned in a guide on https://linuxize.com/ which should probably be trustable. Use at your own risk.

Install a third party repo:

curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -

Install node:

sudo apt install nodejs

Verify it:

node --version

Method 3: NVM/GitHub - Install Node.js on Raspberry Pi

Download and install NVM from GitHub:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

Verify:

nvm --version

Install Node.js using NVM:

nvm install node

Verify:

node --version

Install a couple of alternate versions:

nvm install --lts
nvm install 8.9.4

Show installed versions:

nvm ls

Use another version:

nvm use 10.16.0

Show what version you are using:

nvm current