Nvm uses -node version switch -npm version -node version exception causes error

What is nvm?

.nvm is a node version management tool, which can easily switch, install and view node versions. . . Wait, unlike npm, npm is a management tool for dependent packages.

nvm is a tool for managing npm

Why use it?

Because in actual production, the node version numbers of each project may be inconsistent, resulting in a node error in the local startup project, but there is no problem in the startup project of others

Whose version number does it change?

nvm actually rewrites the version number of the node package

It is not to change the version number of the npm base .

insert image description here

Nor is it dependent on package version numbers . As shown above: The version number of the dependency package in the project is configured in the project, which has nothing to do with the node version number (note: some dependencies need to be run under the specified node version, otherwise an exception will occur, which is the root of why we switch the node version number one of the reasons )

install and use

Operation before installation

Please delete the local node before use. Easy to manage with nvm

Install

Enter the official website http://nvm.uihtm.com/ (click to enter) to download

insert image description here

next step, next step, next step
insert image description here
insert image description here

use (common command)

Because the system environment needs to be changed, please enter CMD (Command Manager) with super administrator privileges

insert image description here

nvm - h

View all nvm commands

nvm install <version> [arch]

Install the specified version of node

Through this command, install the specified version of node to the nvm -list sequence
Example:

 nvm install 18.4.0

Install the node package of 18.4.0

insert image description here

nvm list

View the locally owned node packages in the current environment (node ​​versions that can be switched directly)

insert image description here
With * in front, followed (Currently using 64-bit executable)by the currently used node version

nvm use [version] [arch]

Switch the global node version to the specified version

example:

nvm use 18.4.0

insert image description here

Switch the node package to 18.4.0

other

such as

 nvm uninstall <version>

Uninstallation operation and other functions, because they are used less frequently, so I will not explain them. The above commands are commonly used in actual project development, and can solve more than 90% of node version switching problems. For other content, please move

Guess you like

Origin blog.csdn.net/weixin_44599143/article/details/129598345