Solution is to use Node Version Manager (nvm) which helps manage multiple version of node versions.
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
To see the list of all available nvm versions,
$ nvm ls-remote
Currently, Node v6.11.1 has the long term support (Latest LTS: Boron). We will setup that first version
$ nvm install 6.11
The above command will install Node.js version 6.11.x (where x will be the last available version number)
To find where the node version is installed, type
$ nvm which 6.11
As of this writing, the latest version available is v8.1.4
$ nvm install 8.1.4
When nvm installs the corresponding npm package also gets installed.
You can switch between different versions of the node by typing
$ nvm use 6.11.1
or
$ nvm use 8.1.4
To list all the available versions of installed node versions, type
$ nvm ls