n – Interactively Manage Your Node.js Versions

node -v 

- check node version

n latest

- switch to latest version of node.


- use this to select a version of node to switch to.

nvm install 12.14.1

- By running the above in a terminal, nvm will install Node.js version 12.14.1.
- Tip: nvm-windows users will have to run nvm use 12.14.1 after installing.

nvm follows SemVer, so if you want to install, for example, the latest 12.14 patch, you can do it by running:

nvm install 12.14

nvm will then install Node.js version 12.14.X, where X is the highest available version. At the time of writing, this is 1, so you’ll have the 12.14.1 version installed on your system.

You can see the full list of available versions by running:

nvm ls-remote

For nvm-windows, this is:

nvm ls available


assuming you used 'sudo apt-get install nodejs' and/or 'sudo apt-get install npm'
Use n module from npm in order to upgrade node

sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo n latest

- To upgrade to latest version (and not current stable) version

sudo apt-get install --reinstall nodejs-legacy     # fix /usr/bin/node

- fix PATH

sudo n rm 6.0.0     # replace number with version of Node that was installed
sudo npm uninstall -g n

- to UNDO

Found in David Walsh blog http://davidwalsh.name/upgrade-nodejs

  • web_development/js/node-js.txt
  • Last modified: 2020/09/18 01:10
  • by jimboobrien