nvm install
NVM (Node Version Manager) is a tool for managing Node.js versions, which can install and switch different versions of Node.js on the same computer
1. Official website download
Official website: https://github.com/coreybutler/nvm-windows/releases
2. Installation steps
After decompression, click the exe file to install
3. Increase Taobao mirror configuration
node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/
4. Configure environment variables
5. Test whether nvm is installed successfully
win+r enter cmd, enternvm -v
nvm install node
1. Execute the install node command
Install the specified version of node
nvm install 12.18.2
2. Switch node version
nvm use 12.18.2
3. Verify the current node version
Note: Open a new cmd window, enternode -v
nvm commonly used commands
1. Install the Node.js version
nvm install <node_version>
Used to install the specified Node.js version. Replace <node_version>
with the version number of Node.js you want to install, for example:12.18.2
2. Switch Node.js version
nvm use <node_version>
Used to switch to the specified Node.js version. Replace <node_version>
with the Node.js version number you want to use, for example:12.18.2
3. View the installed version of Node.js
nvm list
Used to list all Node.js versions installed on the current computer, and the version in use (marked with ->
)
4. View the Node.js version available remotely
nvm ls-remote
Used to list all Node.js versions available remotely, including the latest stable and LTS releases.
5. Uninstall the Node.js version
nvm uninstall <node_version>
Used to uninstall the specified Node.js version. Replace <node_version>
with the version number of Node.js to uninstall, for example:12.18.2
6. Set default Node.js version
nvm alias default <node_version>
Used to set the default Node.js version. Replace <node_version>
with the Node.js version number you want to set as default, for example:12.18.2
7. View help
nvm help
Used to view the help information of NVM, which contains all available commands and usage instructions