Raspberry Pi: Install Node.js and npm

It’s become easy to install Node.js on Raspberry Pi with Raspbian.

First of all, download the arm version of the latest Node.js here.
Change below to the version you downloaded.

#!/bin/bash

#Make a new dir where you'll put the binary
sudo mkdir /opt/node

#Get it
wget http://nodejs.org/dist/v0.10.4/node-v0.10.4-linux-arm-pi.tar.gz

#unpack
tar xvzf node-v0.10.4-linux-arm-pi.tar.gz

#Copy to the dir you made as the first step
sudo cp -r node-v0.10.2-linux-arm-pi/* /opt/node

#Add node to your path so you can call it with just "node"
cd ~
nano .bash_profile

#Add these lines to the file you opened
PATH=$PATH:/opt/node/bin
export PATH
#Save and exit

#Test
node -v
npm -v

EDIT
Thanks to johnmclear in the comments who pointed out a huge error in my code. I changed the instructions above so they are correct.