https://nodejs.org/en/download/package-manager/
The code below will install Nodejs 8 (LTS)
$ sudo curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
$ sudo apt-get install -y nodejs
Alternatively, for Node.js 9:
$ curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
$ sudo apt-get install -y nodejs
Optional: install build tools
To compile and install native addons from npm you may also need to install build tools:
$ sudo apt-get install -y build-essential
How to remove Nodejs
https://askubuntu.com/questions/786015/how-to-remove-nodejs-from-ubuntu-16-04
This will remove Nodejs and npm:
$ sudo apt-get purge nodejs
$ sudo apt-get autoremove
RESOURCES
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-16-04