As the Raspberry Pi Zero is based on an older processor technology, the Node.js core team does not provide compiled binaries of newer versions. Here’s a quick guide on how to update anyway.
I use my Raspberry Pi Zero mainly for Homebridge, a way to use non-Homekit devices from my iPhone, iPad and Mac. Homebridge is based on Node.js but as the Pi is based on ARMv6, there is no official version of Node since version 10.x. Newer plugins demand later versions of Node, so I had to find a way to install it.
Fortunately it is pretty straight forward to install it from an unofficial repository. I followed the instructions on this web page, but I replaced the source of the compiled build.
Connect to your Raspberry Pi using SSH.
Find the latest build you want to install at unofficial-builds.nodejs.org/download/release/
When I tried it, the current version was
v15.1.0. In the current directory find the version for ARMv6, which is the file that ends with
Make sure to use the correct version number in the commands below.
On the command line on the Raspberry Pi download that file using the following command:
curl -o node-v15.1.0-linux-armv6l.tar.gz https://nodejs.org/dist/v15.1.0/node-v15.1.0-linux-armv6.tar.gz
Extract the files by using the
tar -xzf node-v15.1.0-linux-armv6l.tar.gz
Move the files over from the extracted directory:
sudo cp -r node-v15.1.0-linux-armv6l/* /usr/local/
In case you are greeted with the following error message:
cp: cannot create regular file '/usr/local/bin/node': Text file bus
You need to remove the node file first:
sudo rm /usr/local/bin/node
Restart the Pi or Homebridge to make the changes stick.
In the end, the whole process was not too bad and felt actually pretty straight forward once I found the unofficial builds.
They are unofficial and unsupported for a reason, so stuff might break in the future, but for now, everything looks good so far.