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'.
Set up the apt-get repo source
curl -sL https://deb.nodesource.com/setup | 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
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 nodejs.org 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 http://nodejs.org/dist/v0.10.2/node-v0.10.2-linux-arm-pi.tar.gz 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:
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:
Install node-gyp with:
npm install -g node-gyp
Now any native module should be compilable.
That’s it. Node in 5 minutes.