How to install latest version of Node.js on Raspberry Pi 3?

Guide to install latest version of Node.js via git.io Node.js version management system

Posted by Amritpal Singh on December 25, 2017

In this tutorial, you will learn to install the latest version of Node.js on your Raspberry Pi 3. The latest image of Raspbian Operating System (as of December 2017) contains an older version of the Node.js application. You can manually update it to the latest version by removing the existing version and re-installing the newest version using "n – Interactively Manage Your Node.js Versions."

Step 1: First remove existing old version from Raspberry Pi

pi@raspberrypi:~ $ sudo -i
root@raspberrypi:~# apt-get remove nodered -y
root@raspberrypi:~# apt-get remove nodejs nodejs-legacy -y
root@raspberrypi:~# exit

Step 2: Installing n will automatically install latest stable version of Node.js

curl -L https://git.io/n-install | bash

Step 3: Verify your installation version

pi@raspberrypi:~ $ node --version
pi@raspberrypi:~ $ npm --version

Step 4: Optional: You can easily switch to different releases

Use or install the latest official release:
pi@raspberrypi:~ $ n latest
Use or install the stable official release:
pi@raspberrypi:~ $ n stable
Use or install the latest LTS official release:
pi@raspberrypi:~ $ n lts

You should now successfully have latest version of Node.js on your Raspberry Pi, if you have any issues please ask question in comments.


1 Comments

leif

copy the line 'curl -L https://git.io/n-install | bash' and got the error mess 'n-install: ERROR: `git` not found, which is required for operation.' What am I doing wrong ?

Add Comment