Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”
Brief introduction:
Node.js Version Management NVM is a nodeJS version management tool.
It’s not uncommon in our daily development to have several projects on hand, each with different requirements, which in turn must rely on different versions of the NodeJS runtime environment
It allows you to install and switch between different versions of NodeJS
Note:
However, if nodeJS is installed before, version conflict will occur when NVM is installed. Therefore, if NodeJS is installed before, uninstall nodeJS first, and then install NodeJS through NVM
NVM ls You can view the list of installed node versions. NVM install "Node version" you can install corresponding nodes. NVM use "Node version" you can use corresponding nodesCopy the code
You can uninstall it by going to control Panel – Programs – Programs and Features
Remember to remove the corresponding environment variables after uninstalling nodeJS
(Control Panel – System Properties – Advanced System Settings – Environment Variables check whether path contains nodejs. If yes, delete it.)
Installation:
Download the installation package from github.com/coreybutler… For Windows, download the nVM-setup.zip installation package
And then just say yes all the time
After the installation, you can use NVM -v to check whether the installation is successful
After the installation is successful, open the folder location and find the setting file to open and add two lines of code
node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/
Copy the code
NVM commands:
NVM on // Enable Node.js version management NVM install <version> // Install node.js named version is the version number for example: NVM install 8.12.0 NVM uninstall <version> // Uninstall Node.js Yes command to uninstall the specified node.js, NVM list available // Displays all node.js versions that can be installed. NVM use <version> // Switch to the specified node.js version NVM v // Displays NVM versions. NVM install stable // Installs the latest stable versionCopy the code
Supplement:
Git is not available in vscode, CMD, Powershell, but can be used in git Bash Here