command -v nvm
nvm current -- or -- node -v
nvm install 16.2.0
nvm uninstall 16.2.0
nvm use 14
locally installed versions: nvm ls
available versions: nvm ls-remote
nvm alias default 14.17.0
nvm alias default 14
- First Check the version of installed npm using
npm -vand then update it to latest version usingnpm install npm@latest -g - To update Node, you’ll need npm’s handy
nmodule. Run this code to clear npm’s cache, install n, and install the latest stable version of Nodesudo npm cache clean -f sudo npm install -g n sudo n stable - To install the latest released version, use
n latest. Alternatively, you can runn #.#.#to get a specific Node version.
Source: How to Update Node.JS to Latest Version (Linux, Ubuntu, OSX, Windows, Others)