I needed to install Node.js on the Raspberry Pi and searching the web gave me so many difficult ways to do it. But since node.js now distributed as a binary for the Raspberry Pi, it’s pretty easy.
First, go to http://nodejs.org/dist/latest/ and find the latest Raspberry Pi release. It’s the file ending in: linux-arm-pi.tar.gz
Then on the Raspberry Pi, update the package list
sudo apt-get update
Update packages
sudo apt-get upgrade -y
Create a directory to install node:
sudo mkdir /opt/node
Change directories to a temporary directory.
cd /tmp
Download the latest release you found at http://nodejs.org/dist/latest/
wget http://nodejs.org/dist/latest/node-v0.10.17-linux-arm-pi.tar.gz
Uncompress it:
tar xvzf node-v0.10.17-linux-arm-pi.tar.gz
Copy it to your new directory:
sudo cp -r node-v0.10.17-linux-arm-pi/* /opt/node
Then add it to your environment variables by opening or creating .bash_profile in your home directory. (You nano if you can’t use vi.):
cd
vi .bash_profile
Add the following to your .bash_profile
PATH=$PATH:/opt/node/bin
export PATH
After saving the file, you’re all set!
Comments closed