There are two ways…
The easiest is to install using the package manager. Recently though I ran into an issue where the folks providing the package manager version forgot to include the ARMv6 build. If that’s the case while you attempt, move onto the tarball method and you’ll be up and running in no time.
With package manager…
First, install NodeJS. At the time of this writing, I prefer NodeJS 6. The best way to install it is through the package manager. This site contains all the details:
https://nodejs.org/en/download/package-manager/
The important bit is this (Note: this can take a little while):
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
When package manager fails! The tarball method…
Sometimes the folks supporting the builds have a glitch, and the ArmV6 version of the build doesn’t get published…. so it will complain with this message:
“## You appear to be running on ARMv6 hardware. Unfortunately this is not currently supported by the NodeSource Linux distributions. Please use the ‘linux-armv6l’ binary tarballs available directly from nodejs.org for Node.js v4 and later.”
Which is bunk, but here is the work around during these dark times:
wget https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-armv6l.tar.xz
tar xvf node-v10.15.3-linux-armv6l.tar.xz
cd node-v10.15.3-linux-armv6l
sudo cp -R bin/* /usr/bin/
sudo cp -R lib/* /usr/lib/
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install build-essential
4 thoughts on “Installing NodeJS on a Raspberry PI”