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.
2. Use the nvm list available command to view a partial list of downloadable versions.
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.
Use nvm install + version number to install the specified version of nodejs.
5. After successful installation You can use it to node -v
view it. If you can see the node version, it means the installation is successful. You
can also use it nvm ls
to 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.
6. When using node.js,
use nvm use [version]
the specified node version.
You can see that the node version has been switched successfully.