Install NodeJS v0.12.0 on Raspberry Pi

Reasons Why

Here at work I use NodeJS on my Raspberry Pi for quick script hacks. Most notable are quick and dirty API displays such as Twitter Streams, latest code commits from a Bitbucket repository and a dashboard of server information.

This Time

This time we won't be compiling a binary - but we will use a prepackaged binary that would normally be available from NodeJS.org - but at time of this writeup there is an "Illegal Exception" bug in the prebuilt binaries. We are going to lean on the support from the NodeJS community on this one. More specificily from this website Node-ARM.

Update/Upgrade

First off we need to make sure we have the latest packages installed on our system. A quick update/upgrade from our package manager should do the trick:

sudo apt-get update;
sudo apt-get upgrade;

Grab the Binary

At the time of this writeup the latest version of NodeJS compiled for Linux ARM is v0.12.0. We will grab the binary by running the wget command from our home directory:

cd ~;
wget http://node-arm.herokuapp.com/node_latest_armhf.deb;

Now we need to run the install process:

sudo dpkg -i node_latest_armhf.deb;

And we can verify our installation by checking the --version number:

node -v;
v0.12.0

Install node-gyp

Since we have npm installed it'd be nice to install a global version of the node-gyp command. This command is used to build native commands and is used in a lot of projects I use as a dependency. It's as easy as:

sudo npm install -g node-gyp;

Questions?

Since we've unlocked the potential of a very powerful scripting language for our Raspberry Pi. What are some potential uses you have for your Raspberry Pi?