Via NVM (Node Version Manager)
# get the latest nvm release https://github.com/creationix/nvm/releases
curl https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash
# OR
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash
# Restart your terminal or run
source ~/.profile
# Install the NodeJS version needed
nvm install 4.1
# update npm
npm install npm -g
Via PPA
curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -
sudo apt-get install -y nodejs
# update npm
npm install npm -g