Install Node on the Raspberry Pi in 5 minutes

Don’t follow the old instructions. These new ones work with current Raspian as of May 28th 2015. These instructions will get you node v0.10. I don’t recommend moving to v0.12 just yet as some parts are still in flux

Update the OS

sudo apt-get update sudo apt-get upgrade

Verify node isn't installed yet. It should print 'command not found'.

node —version

Set up the apt-get repo source

curl -sL | sudo bash -

Install Node itself

sudo apt-get install nodejs

I then had to log out and log back in to get the path right.

node —version // should print version 0.10.38 or similar
npm —version should print 1.4.28 or similar
sudo node —version should work as well

That's it!

Do not follow the instructions below. They are old. Only follow the ones above.

Installing Node on a Raspberry PI used to be a whole lot of pain. Compiling an codebase that big on the Pi really taxes the system, plus the usual dependency challenges of native C code. Fortunately, the good chaps at have started automatically building Node for Linux arm Raspberry Pi. This makes life so much easier. Now we can install node in less that five minutes. Here’s how.

First, make sure you have the latest raspbian on your Pi. If you need to update it run.

sudo apt-get upgrade; sudo apt-get update

Node and NPM

Now install Node itself

wget tar -xvzf node-v0.10.2-linux-arm-pi.tar.gz node-v0.10.2-linux-arm-pi/bin/node --version

You should see:


Now set the NODE_JS_HOME variable to the directory where you un-tarred Node, and add the bin dir to your PATH using whatever system you prefer (bash profile script, command line vars, etc); In my .bash_profile I have:

NODE_JS_HOME=/home/pi/node-v0.10.2-linux-arm-pi PATH=$PATH:$NODE_JS_HOME/bin

Now you should be able to run node from any directory. NPM, the node package manager, comes bundled with Node now, so you already have it:

npm —version



Native code

If you are just working with pure javascript modules then you are done. If you need to use or develop native modules then you need a compiler and node’s native build tool, node-gyp. The compilers should already be installed with Raspbian. Check using:

gcc —version

Install node-gyp with:

npm install -g node-gyp

Now any native module should be compilable.

That’s it. Node in 5 minutes.

Talk to me about it on Twitter

Posted October 23rd, 2013

Tagged: node raspberrypi