Copy and paste the following into your terminal:

sudo su
apt-get install -y gcc g++ git-core libssl-dev
curl -lO https://raw.github.com/isaacs/nave/master/nave.sh
chmod +x nave.sh
./nave.sh usemain 0.4.11
curl http://npmjs.org/install.sh | sh

After you authenticate with your password, go get a cup of your beverage of choice, this is going to take a while :-)