On Ubuntu

sudo apt-get install node npm -y
sudo npm install -g grunt-cli
sudo ln -s "$(which nodejs)" /usr/bin/node

To install latest

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

Install with Node Version Manager (NVM)

sudo apt-get install build-essential libssl-dev
git config --global http.sslVerify false
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.1/install.sh | bash
source ~/.bashrc
nvm install v5.4.0
nvm use v5.4.0
nvm alias default v5.4.0
nvm ls