Running NodeJS on Raspberry Pi

Getting NodeJS on a Raspberry Pi running the latest version of Raspbian isn’t as dead simple as it is on PCs, Mac OS X, or Linux. Only special versions of NodeJS were pre-built for Linux on ARM for Pi and a list of those versions doesn’t seem to be listed in an easy format.

In my case, I wanted to download NodeJS version 0.10.29 and the next closest NodeJS version for ARM was v0.10.28 or v0.10.30. You can search through each directory in the NodeJS distribution directory, but here is a small list of available Linux ARM versions when I last looked:

  • http://nodejs.org/dist/v0.10.28/node-v0.10.28-linux-arm-pi.tar.gz
  • http://nodejs.org/dist/v0.10.3/node-v0.10.3-linux-arm-pi.tar.gz
  • v0.11.12 through v0.11.0 all have Linux ARM versions for pi as well:
    • http://nodejs.org/dist/v0.11.12/node-v0.11.12-linux-arm-pi.tar.gz

In order to download them onto your Raspberry Pi you will need to type these commands into the shell, replacing the version for whichever you want:

wget http://nodejs.org/dist/v0.10.28/node-v0.10.28-linux-arm-pi.tar.gz
tar -xvzf node-v0.10.28-linux-arm-pi.tar.gz
node-v0.10.28-linux-arm-pi/bin/node --version

Now that you have it downloaded on your machine, you will want to add it to your path in order to allow it to be used from anywhere. So you will want to alter (or create if you don’t have one yet) a .bash_profile file in your root:

sudo nano ~/.bash_profile

then add these lines to the file:

Now after you reboot, you should see that you are able to use NodeJS regularly.

sudo reboot