Installing node.js on a Raspberry Pi

Several months ago I acquired my very first Raspberry PI. One of the first things I wanted to try is how well node runs on it. Node works like a charm and installing it on a Raspberry Pi is actually pretty easy and straightforward.

Download the binary archive and Extract it

First of all you must download the latest node binary archive that is compatible with the Raspberry Pi's ARM-based architecture. I wrote nodepi, a little express app which lists all of the node versions that provide an official arm-pi binary archive.

Simply grab the version you want (remember that node uses the even/odd version numbering system) and click the download button.

You can also curl the version you wish to download.

$ curl -L http://nodepi.herokuapp.com/v0.10.24 -o node.tar.gz
$ tar xvfz node.tar.gz

Note that nodepi simply redirects to the appropriate file location on http://nodejs.org/dist. The main reason why I wrote nodepi was to not have to manually look through nodejs.org/dist for a specific node version which has an available arm-pi binary.

Update your PATH

There are many great blog posts that will show you how to update your path so you can execute node in your terminal

Basically once you've extracted the node archive, move it to a predictable location and simply add that location to your path in your .bash_profile file and your done!

PATH=$PATH:/home/pi/node-vx.x.x/bin
export PATH

To check that node and npm have been correctly added to your path

$ node -v
$ npm -v