Install NodeJS and NPM on Ubuntu 16.04

Last updated:

Install Nodejs 8.x and NPM

Using node source distributions

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

Check that you got the most recent versions

(as of this post, it's NPM 5.3.0 and NodeJS v8.2.1)

$ npm -v
5.3.0
$ node -v
v8.2.1

Fix permissions

This is to enable you to install stuff without using sudo

type: sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

As per these instructions on the official npm docs

Dialogue & Discussion