NodeJS on Raspberry Pi Zero


You can find a list of distributions here:

https://github.com/nodejs/unofficial-builds

When you find the version you’d like to install, you’re looking for the armv6l architecture. For example:

https://unofficial-builds.nodejs.org/download/release/v12.18.3/node-v12.18.3-linux-armv6l.tar.gz

Now you might be wondering, well how is this different from what I’d get on NodeSource? Remember, the recommended way to install Node.js is by executing a script which places something in your apt-get repository list. This method of downloading the node-v9.7.1-linux-armv6l.tar.gz file doesn’t help us in the slightest in terms of apt-get.

SSH into the Raspberry Pi Zero W and execute the following command:

wget https://unofficial-builds.nodejs.org/download/release/v12.18.3/node-v12.18.3-linux-armv6l.tar.gz

The above command will download the file to your device. Yes, there are probably 100 other ways to accomplish the task, but this is my preference.

With the archive downloaded, execute the following from the device:

tar -xzf node-v12.18.3-linux-armv6l.tar.gz

The above command will extract the archive, creating a new directory at the current path. The directory includes everything we need to use Node.js and the Node Package Manager (NPM). We just need to transfer the content to the correct locations.

Execute the following on the Raspberry Pi Zero W:

sudo cp -r node-v12.18.3-linux-armv6l/* /usr/local/ 

The content copied should already be in your $PATH, so at this point you’re ready to start using Node.js. You can validate that everything works by executing the following:

node -v
npm -v

One other thing to note is that NPM relies heavily on Git being available. By default the Raspbian Linux distribution will not have Git already downloaded. It can easily be installed by executing the following:

sudo apt-get install git

You can start developing Node.js applications to be deployed on your Pi Zero W or any other device for that matter, as long as you find the correct build architecture.

Last update:
12-10-2020 12:47
Author:
Karl Hudgell
Revision:
1.2
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Latest FAQs RSS

  1. Custom Button Card (23-11-2020 10:02)
  2. NodeJS on Raspberry Pi Zero (12-10-2020 12:47)
  3. Useful Notes (13-11-2019 12:51)
  4. Dockerized Download VM (30-01-2019 20:26)
  5. Jmeter + Performance Plugin + Jenkins Pipeline (16-02-2018 12:49)