Raspberry Pi Zero – NodeJS

I finally got my hands on the Raspberry Pi Zero from adafruit. It’s a nice little $5 computer, well $5 for the board, $10 for the 8GB micro SD card, $10 for the micro HDMI adapter and $10 for the WiFi adapter. After all that’s done it’s not far from the Raspberry Pi 3 which is a really nice little computer. However the Zero is about one third the size of the Pi 3, so it’s great for hiding in small places.

I use NodeJS for rapid prototyping of systems. It runs fast enough on a Raspberry Pi 2 or 3, it can access the GPIOs, it can be a web server or just about anything else you might want. However NodeJS on Debian is still stuck at version 0.12 while NodeJS is shipping 4.4.2 for long term support and 5.10.0 in their stable branch.

I’ve used the script at https://deb.nodesource.com/setup_5.x to install NodeJS on my other Raspberry Pi’s, and the installation on the Zero went just as expected. After the installation finished I typed in

$ nodejs -v

to make sure that the installation was successful and didn’t get what I expected. I expected to get “v5.10.0” and instead I got “Illegal instruction”. I tried with npm and got the same error.

After further investigation I found that the builds at nodesource are built for the ARMv7 architecture, while the Pi Zero uses the ARMv6 architecture.  Fortunately NodeJS has a download for all sorts of architectures right here. I downloaded the node-v5.10.0-linux-armv61.tar.xv and then it was a simple install:

$ tar xf node-v5.10.0-linux-armv61.tar.xv

$ cd node-v5.10.0-linux-armv61

$ sudo cp -R bin include lib share /usr/

$ nodejs -v


This still requires the script at https://deb.nodesource.com/setup_5.x, but then replaces the binaries with the ARMv6 binaries.

This entry was posted in Mike.