1. What is nvm?
nvm is a tool to manage nodejs version. In actual development, the development dependencies of some projects require different versions of the nodejs operating environment. At this time, we need to use nvm to manage the nodejs version.
2. Installation steps
2.1 Download nvm :
https://github.com/coreybutler/nvm-windows/releases
2.2 Decompression
After decompression, double-click the suffix exe file to install:
1) Agree to the content of the agreement
2) Click Next and select the installation path to install nvm
3) Create a node.js installation to select the installation path of nvm
3. Command usage
nvm -v: view the current version
nvm list or nvm ls: view the list of installed node versions
nvm install version number #Install the specified version (eg: nvm install 14.19.1)
nvm use version number #Switch to the specified version (eg: nvm use 14.19.1)
nvm uninstall version number #Uninstall the specified version (eg: nvm uninstall 14.19.1)
nvm use version number: switch node version
nvm on: turn on nvm
nvm off: turn off nvm
nvm list available: View available node version numbers
4. nvm image source settings
4.1 Method 1: Execute commands in the terminal
//设置nodejs下载源
nvm node_mirror https://npmmirror.com/mirrors/node/
//设置npm源
nvm node_mirror https://npmmirror.com/mirrors/npm/
4.2 Method 2: Enter the nvm-windows installation directory, edit settings.txt, and add the following content
node_mirror: http://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/
4.3 After adding settings.txt
第一行是nvm安装路径
第二行是nodejs路径
第三行是node下载镜像
第四行是npm下载镜像