Upgrading Node.js

Developers come across a configuration error showing to upgrade Node.js version to the latest while trying to install libraries and new tools. Installing Node.js again is disastrous since you might loose your project folders.

For Linux/Mac:

Type the sudo command. The n module does the version-management.

sudo npm install n -g

To upgrade to the latest stable version.

sudo n stable

To upgrade to latest version:

sudo n latest

For Windows:

You have to reinstall node from the .msi in Windows from the node website.

Without using sudo you can install latest version of Node.js. Current stable LTS version was released in September. Get the Node Version Manager.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

Now install the Node.js version.

nvm install v10.16