Installing Node.js on the Raspberry PI

I’ve been playing with one of my raspberry pi device quite a lot lately and though that it can actually be the perfect little dev server for me as it is quite portable and really powerfull. I bought a multitude of SD sticks for it and even got it to go off a USB flash stick. Its a realy nice tinkerer’s device.

To get straight to the point I though I would share a script I wrote to get the latest node js (Well at least currently version 10.0.5) going on your box. With previous versions you had to compile it on your pi and do all kinds of interesting things to actually get it to compile. They have made it really simple at this point and to get it going , you have to do the following easy steps:
  • You have to download the Pi specific version.
  • You then have to unpack it.
  • You then add it to your bash.rc as an extra path paramater to the extracted node bin path (if your not using bash, it should be similiar in your shell).
And thats it. 🙂
I have also provided the script here to simplify your life.
Hope this helps at least someone out there. Did the trick for me 🙂
#Get all the prerequisites needed
echo "===== Get all pre req's ! ====="
sudo apt-get install python2.7 make
echo "=== Go to the local folder where we will deploy. ===="
cd /usr/local
sudo mkdir node
cd node
#Get the latest version of Node for PI - at this point in time it is 10.5
echo "===== Downloading Node ! ======"
sudo wget
echo "===== Unpack the archive ! ====="
sudo tar xvzf node-v0.10.5-linux-arm-pi.tar.gz
echo "===== Rename folder to a simpler name ! ====="
sudo mv node-v0.10.5-linux-arm-pi node-v10.5
cd node-v10.5/
#echo "===== Configure it ! ====="
#sudo ./configure
#echo "===== Compile and install ! ====="
#sudo make
#sudo make install
echo "==== Add link to path as v 10.5 is compiled already ====="
sudo echo 'export PATH=$PATH:/usr/local/node/node-v10.5/bin'>> ~/.bashrc
echo"==== Now we will check if it is all there ===="
node -v
npm -v
echo "==== DONE ===="