Upgrade Node from 6 to 8 using nvm
If you need to upgrade your node installation from 6 to 8 (and even from any version to any another version) one alternative is to use Node Version Manager, in order to do that you need to follow these steps
apt-get install build-essential checkinstall libssl-dev
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
source .zshrc #or source .bashrc to reload the env settings
nvm i v8
nvm alias default v8
That’s it, you will have node 8 running in your user, keep in mind that, nvm works for each user and to setup the preference nvm installs a couple of commands in your shell rc to setup which version are you wanted to use.
More Links
http://www.hostingadvice.com/how-to/update-node-js-latest-version/
https://www.joyent.com/blog/upgrading-nodejs-to-8
https://www.digitalocean.com/community/tutorials/como-instalar-node-js-en-ubuntu-16-04-es