Install Latest Node JS on Raspberry Pi All Models

8

As of the time of this writing, the version of Node JS that comes with Raspbian is v 0.10.29. It has some bugs and is an old version considering the latest stable version is v6.x.x and the latest LTS version is v4.4.4 LTS (as of the time of this writing). Here is how you install the latest LTS version of Node JS on All versions of Raspberry Pi. First, we need to remove the old Node JS.

Type the following into your Raspberry pi terminal to remove old Node JS.

Great, now all traces of the old Node JS is gone. Now we get to pick our version.

For v4.4.3 LTS (recommended)

For v 5.x.x

** Update 5/24/2016 **
For v 6.x.x

That is it. You can make sure it worked by entering the following.

It should output whatever version you installed. You also now have NPM, which strangly was not packaged with Raspbian with Node. You can check it’s version as well.

Enjoy!

** Update 5/24/2016 **

I noticed that this method did not work on a raspberry pi zero. It should, but doesnt for some reason. If you are having issues uninstall nodejs and npm installed via apt-get using the first set of commands. Then use the following for 4.4.5.

You can change the version number in the commands for whatever version you want.

Share.

About Author

I love to tinker, code, and create electronics. I primarily focus on Raspberry Pi (and other linux SBCs) and Arduino (and other microcontrollers that run on the Arduino platform).

  • Shu Kin

    Thank you! very useful tutorial:)

  • tRASTE

    umm… so what about nodered? its just to be uninstalled and thats it? or is it reinstalled by the node.js installer automagically somehow?

  • Leonardo Vegas

    thanks so much!

  • Thank you much! I couldn’t find anywhere to install a recent node distribution on my Raspberry Pi 1 and this did the trick.

  • richard

    hi thanks for this instructive tutorial, helped me no end as I’m new to linux/rasp pi. I wonder do you know if its possible to get the babel trans-compilation working to get es6 working on a pi? Thanks

    • I’d imagine it doesnt have arm bianaries. Npm will build them if you have the required packages installed. Run ‘sudo apt-get install build-essential’ then ‘sudo npm install node-gyp -g’. Then run your npm install for your transpiler. This should give npm the tools needed to build any package from source if the ARM binary is unvalable. Let me know if that works.

  • Kjell

    Thank you very much! Helped me a lot

  • Android4208

    I followed the instructions under *Updated* section on my PI0W. When I run node -v it says it cannot be found. Please help!