Raspberry PI 3: How to install NodeJS in 4 easy steps

Home / IOT / Raspberry PI 3: How to install NodeJS in 4 easy steps


Raspberry PI 3: How to install NodeJS in 4 easy steps

When you unbox a Raspberry PI 3, it comes with a rather old NodeJS version pre-installed.
This tutorial will help you installing the latest version of NodeJS on your Raspberry PI 3, which is currently 5.0.

Step 1: download newest version of NodeJS

The first thing to do is to download the latest version of NodeJS. This is at time of writing version 5.0.
U can lookup the latest version at https://nodejs.org/dist, but be sure to take the node-vX.Y.Z-linux-armv7l.tar.gz version.

wget https://nodejs.org/dist/v5.0.0/node-v5.0.0-linux-armv7l.tar.gz

Step 2: unpack the downloaded file

Now that we’ve got the latest distribution, we need to unpack this file:
tar -xvf node-v5.0.0-linux-armv7l.tar.gz

Step 3: copy the files to /usr/local

Now we need to copy all the unpacked files to the /usr/local folder.

cd node-v5.0.0-linux-armv7l
sudo cp -R * /usr/local/

Step 4: replace the symbolic links from the old NodeJS executables to the new

With the previous steps we added the new version of NodeJS to our Raspberry PI, but if you issue node -v you will still get the old version.
To get the newest version of the executable to be called, we need to change the symbolic links pointing to the executable.

We will first take a backup of the old link file:

cd /usr/bin
sudo mv node node-old

And finally we will re-create the symbolic link to the new NodeJS executable:

sudo ln -s /usr/local/bin/node node

Now verify the installation by issuing node -v.

Conclusion

In this article we saw how to upgrade the pre-installed NodeJS version of the Raspberry PI 3 in 4 easy steps.
Basically this comes down to downloading the latest version and replacing the symbolic link to the new NodeJS executable.

If you liked this tutorial, then please link to it and/or like it with the button below.



%d bloggers like this: