Installing Node.js on Raspberry Pi

Node and Pi

About

For those having a hard time finding a guide on how to install node and npm on a raspberry pi, look no further. Here is a simple guide to follow. This shows guide shows how to install the latest version of Node.js on the Pi

Advertisment


You will Need:

● Raspberry Pi with internet connection (You could also download the file and install it on an offline Pi)

Prerequisites:

● Have a Raspberry Pi already configured & connected over SSH or with a monitor

Programming:

Step 1: Update Raspberry Pi with sudo apt-get update then sudo apt-get upgrade. This may take a while.

Step 2: Now download the latest version of node.js for Pi. The latest version I could find was last updated on 11 March 2014. Do this with
sudo wget http://nodejs.org/dist/v0.11.12/node-v0.11.12-linux-arm-pi.tar.gz

Step 3: Next unzip the downloaded file with
sudo tar xvzf node-v0.11.12-linux-arm-pi.tar.gz && sudo rm node-v0.11.12-linux-arm-pi.tar.gz

Step 4: Then we will make the node directory and move the files. –
sudo mkdir /opt/node then
sudo mv node-v0.11.12-linux-arm-pi /opt/node. Then
sudo mkdir /opt/bin and
sudo ln -s /opt/node/bin/* /opt/bin/

Step 5: Finally if its not already add /opt/bin to the list of default paths:
sudo nano /etc/profile and modify
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin"

Step 6: Test the installation with node -v and npm -v You should receive version numbers.

Advertisment


Conclusion:

Congratulations on installing node.js on Pi. If you would like to know more or to suggest something please comment.

Leave a Reply

Your email address will not be published. Required fields are marked *