Installing nodejs and npm on Ubuntu

Ubuntu’s apt-get has outdated versions of nodejs.. The right way to to intall nodejs on Ubuntu is to use the repo maintained by nodesource. Update apt-get with this repo and then install..

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

Look in the nodesource repo above to get the right version you need.