Whenever I have to update the node version I do it using npm along with module "n" although there are other options, but this one seems to me the most comfortable.
Before upgrading I check the node and npm version with the commands:
node -v npm -v
I proceed to install the latest version of npm with:
This requires access permissions to the path of the node configuration "prefix" attribute. To clarify concepts see my entry in:
npm install npm@latest -g
Then we clear the npm caches with:
sudo npm cache clean -f
The next step is to install module "n" by running the command:
npm install -g n
And finally install through module "n" the latest stable version of node with:
sudo n stable
With module n you can see the available versions by running 'n' and gives you the option to install or delete one of the versions that appear in the list. You can also specify the installation of a specific version of node. I give you an execution screen of the 'n' command without any options:
I recommend the use of "n", it is very intuitive.