Install latest version of NodeJS on Raspberry Pi

Installing NodeJS on a Raspberry Pi used to be something difficult. However it's really straightforward and easy to do these days by downloading a pre-compiled archive from the NodeJS archives.

Just make a script called on your Raspberry Pi and paste the following contents in it. At the time of writing the latest available version of NodeJS is 10.8.0, change the VERSION variable to whatever version you like.

#!/usr/bin/env bash


tar xf node-v$VERSION-linux-$ARCH.tar.gz
rm -f node-v$VERSION-linux-$ARCH/*
pushd node-v$VERSION-linux-$ARCH/
sudo cp -R * /usr/local/
rm -rf node-v$VERSION-linux-$ARCH
rm node-v$VERSION-linux-$ARCH.tar.gz

Now make the script executable using chmod +x ./ and execute it afterwards using ./ After it finished you should have your desired NodeJS version installed.

You can verify this by running node --version. Enjoy 🍻!