Note: Uninstall the installed Node and remove the environment variables before installing the NVM
1. Install the NVM
1.1 Download the NVM from Githubnvm-setup.zip, click on theDownload address
1.2 Decompress and double-click the decompressed filenvm-setup.exeThe NVM installation starts
Tick to accept
, and click next
To set the installation path for NVM, click Next (either the default or custom installation path is available; I chose the custom installation path here)
To set the installation path for Node, click Next (I still chose the custom installation path)
Click Install to Install
Click Finish to complete the installation
1.3 About Setting Environment Variables (There are user environment variables and system environment variables
)
My environment variable
After installing the NVMautomatic
It’s set. If it’s not set automatically, do it yourself
(NVM_HOME and NVM_SYMLINK are set according to their own installation path above)
NVM_HOME: indicates the NVM installation directory
NVM_SYMLINK: node installation path
1.3.1 User environment variables
Add to Path in the user environment variable
1.3.2 System environment variable
Add to Path in the system environment variable
1.4 Verifying the NVM installation
I’m going to usegit BashFor validation, you can also usecmd
As shown in the figure above, the installation is successful
2. Use NVM to manage multiple versions of Node.js
2.1 How to Speed up node Download (Using Taobao Image Source)
Use for example: vscode/Sublime (do not use Notepad) to open the NVM installation directorysettings.txt
file
Add the following code (remember to save before closing the file) :
arch: 64
proxy: none
node_mirror: http://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/
Copy the code
This will make node installation much faster
2.2 Common Commands
NVM install (node version number) -> Install the specified version of node for example, (NVM install 14.15.0) install the 14.15.0 version of Node NVM uninstall NVM use (Node version number) -> Switch the node of the specified versionCopy the code
2.3 NVM ls Command
* indicates the current node version
3. View the node and NPM versions
Node automatically installs the corresponding version of NPM during installation
usenode -v
和 npm -v
Check the version