Correct operation of node.js/npm upgrade (both windows and Linux)


Original address: Correct operation of windows and Linux upgrade

Today, let’s summarize the correct operation of node.js and NPM upgrade.
Xiaobian’s personal experience can use the following steps to solve the node version problem and the skipped pit. Please pay attention to the problem and click like!

The installation is relatively simple. There is no demonstration here. The official address is attached:

In general, we choose to update the node first, and then follow the new NPM

Update under Windows system

You may find some tutorials on the Internet, but you will report errors

Git BASH (MSYS) is not supported by n
 Error: no version found for 'latest'

Because the N module does not support windows
Therefore, you can only download the latest version from the official website and install it.
Official website:
Note that here you can look at the environment variables and overwrite the path before installation.

The specific steps are:
My computer — right click — properties — advanced — environment variables
Then check the path to find the path of nodejs. During installation, select this path to overwrite the installation.

Update under Linux system

Run first

npm install n -g

Install n dependent packages
Before that, you can configure Taobao image

npm config set registry

In this way, you can use CNMP installation to greatly improve the installation success rate and speed. You can use cnpm command to install n module dependencies

npm install n -g

Update the node version to the latest version of N latest and to the stable version of N stable

#Latest edition
n latest
#Stable version
n stable