I download the last raspbian version (2016-05-27) on https://www.raspberrypi.org/downloads/raspbian/

Node.js is already installed with the 0.10.29 version, so I removed that and reinstalled it with

apt-get remove nodered
apt-get remove nodejs nodejs-legacy
curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -
sudo apt-get install -y build-essential python-rpi.gpio nodejs

But I would like my SD card to work on all Raspberry Pi models (Pi 1, 2, 3 and Zero) Currently, when I do a

node -v

on a Pi 1 or on a Pi zero, I get a "illegal instruction".

My question is: It is possible to install a copy of Node.js on a Pi that works on all models? Or is v0.10.29 the only one that works on all Pis?

  • If you download sources from random web-sites you must expect problems. What makes you think that version of Node.js is suitable for the Raspberry Pi?
    – joan
    Jun 3, 2016 at 8:43
  • This is NOT a random website, but where the official nodejs install instructions point you to. Rest see my answer.
    – Grmpfhmbl
    Jun 3, 2016 at 14:01

5 Answers 5


The reason why this is not working on your Raspberry Pi 1 is, that these packages are compiled for the wrong CPU - armhf (ARM 32-bit hard-float, ARMv7 and up: arm-linux-gnueabihf)

So the package should work on your Pi2 but not on the Pi1. I guess there is no quick and easy way to get an image that runs on both. If you want to install a modern nodejs on your Pi1, download the correct tarball from https://nodejs.org/dist/ For example:

cd ~
wget https://nodejs.org/dist/v6.2.1/node-v6.2.1-linux-armv6l.tar.gz
tar -xzf node-v6.2.1-linux-armv6l.tar.gz
node-v6.2.1-linux-armv6l/bin/node -v

The last command should print v6.2.1.

Now you can copy it to /usr/local

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

For testing add /usr/local/bin to your path

export PATH=$PATH:/usr/local/bin
node -v
npm -v

This should print 6.2.1 and 3.9.3 for the versions of nodejs and npm. If you need a different version, just pick the one you like from the downloads.

Don't forget to add the PATH to your .bashrc to make it permanent.

To find the correct architecture, you can type cat /proc/cpuinfo in a terminal and that should show something like

pi@raspberrypi:~ $ cat /proc/cpuinfo
processor   : 0
model name  : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS    : 697.95
Features    : half thumb fastmult vfp edsp java tls 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xb76
CPU revision    : 7

update Just saw this answer https://raspberrypi.stackexchange.com/a/37976/34825 that basically does the same as I did, except install node in /opt/ and create symlinks in /usr/bin/.

  • thank you for your answer, I think i will install 2 nodejs (one armv6 and one armv7) and add a service for create on boot a symlink on /usr/bin/node with the correct node (into /usr/local/bin/node_armv6 or /usr/local/bin/node_armv7)
    – 4Taine
    Jun 3, 2016 at 14:30
  • That worked, great. managed to get Node 7.7.4 installed on my Pi Zero W. Thanks! Mar 25, 2017 at 14:11
  • To whoever reads this: You probably want the newest node version instead of version 6.2.1. Simply replace the version number in all of the commands above with your chosen version from nodejs.org/dist
    – otoomey
    Apr 21, 2018 at 19:46

In one line of code, latest version, for any raspberry pi:

wget -O - https://raw.githubusercontent.com/audstanley/NodeJs-Raspberry-Pi/master/Install-Node.sh | sudo bash;
node -v;

Source code: https://github.com/audstanley/NodeJs-Raspberry-Pi/

  • At first glance there seem not to be any sanity checks in the script. I'd be very careful to just run this as root.
    – Grmpfhmbl
    Mar 11, 2018 at 12:59
  • This was solving my issue about the outdated Nodejs in armv6 when installing with apt install May 8, 2019 at 1:53
  • @Grmpfhmbl I agree - and I wrote the code. Please launch the container, and verify the checksums yourself. Friends don't let friends pipe into sudo bash - but here we are.
    – Audstanley
    Dec 23, 2022 at 3:57

I liked Audstanley's solution above although it didn't work for me out of the box.

I found that I needed to run the script with root access.

This worked for me:

sudo bash
sudo wget -O - https://raw.githubusercontent.com/audstanley/NodeJs-Raspberry-Pi/master/Install-Node.sh | bash
node -v
  • 1
    It did not work because you run "wget" as root and not the bash that runs the script. Simply put the "sudo" after the pipe in front of "bash".
    – Grmpfhmbl
    Mar 11, 2018 at 12:39

I had the same issue and made some quick bash scripts for installing node v4, v5 and v6.3.1:


They are for the Pi Zero but should work for all ARMv6 compatible chips (1A 1B). In fact this should even work on the ARMv7 chips (2B 3B) as they are happy with the older binaries.

Hope you find them useful.


Or get the latest version:

NODE="$(curl -sL https://nodejs.org/dist/latest | grep 'armv6l.tar.xz' | cut -d'"' -f2)"
wget https://nodejs.org/dist/latest/$NODE

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.