Here is how to install node and npm in ubuntu.

The ~/local directory is to store all of your user-level packages, btw.

mkdir -p ~/local
mkdir -p ~/node-latest-install

cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1

./configure --prefix=~/local   # if SSL support is not required, use --without-ssl
make install

cd ..
rm -rf ~/node-latest-install

Then in your ~/.bashrc file, append the following line.

export PATH=$PATH:'~/local/bin/'

Then source your new .bashrc by source ~/.bashrc

If everything goes well, the following commands should return the version info.

node -v
npm -v

ref: https://gist.github.com/dwayne/2983873