Use nvm to install multiple node.js and easily switch between different node versions.

Use nvm, the node.js version management tool, to download multiple node versions at the same time to solve the incompatibility problem of various node.js versions. Through nvm, you can install and switch different versions of node.js.


Problem Description

In front-end development, when using npm to download dependencies, the node version is too low.
At this time, downloading of dependent packages will fail.
You can use the nvm version management tool to download multiple node.js versions on your computer at the same time to meet development needs.

what is nvm

nvm, also called node.js version management in English, is a nodejs version management tool. nvm and n are both node.js version management tools. In order to solve the incompatibility of various node.js versions, you can use them to install and switch different versions of node.js.
nvm official download address.
For the specific installation process of nvm, please see the official introduction of nvm.

nvm install node.js

1. First open CMD and enter the command nvm. If the installation is successful, the following display will appear.
nvm installed successfully
2. Use the nvm list available command to view a partial list of downloadable versions.

Insert image description here
3. Use nvm install latest to install the latest version. You can see the version number of node.js during installation, but it is not officially recommended to install the latest version. 4.
Insert image description here
Use nvm install + version number to install the specified version of nodejs.
Insert image description here
5. After successful installation You can use it to node -vview it. If you can see the node version, it means the installation is successful. You
Insert image description here
can also use it nvm lsto view the installed version. The one with * indicates the version currently in use. If there is no asterisk in front of a version number, it means that no one has been used yet. node version. If you use node.js at this time, an error will be reported.
Insert image description here
6. When using node.js,
use nvm use [version]the specified node version.
Insert image description here
You can see that the node version has been switched successfully.

node command prompt

Insert image description here

Guess you like

Origin blog.csdn.net/weixin_44132277/article/details/124345575