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
Procedo a instalar la última versión de npm con:
This requires access permissions to the path of the node configuration "prefix" attribute. See my entry in How to fix the Error: EACCES: permission denied, unlink '/usr/local/bin/jhipster' when installing generator-jhipster library node with npm to clarify concepts.
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.