Daily development sometimes involves maintaining multiple projects, and as the time span increases and our front-end technology changes rapidly, it is inevitable that some projects will depend on different Versions of Node. At this point we thought it would be nice to have a node version switching tool, and there is one: NVM
If you already have Node installed, you need to uninstall node first. If you don’t have Node installed, skip this step and go to the next step
1. To see if we have Node installed, open your terminal input
node -v
Copy the code
2. Open the control panel => Open programs and functions => Search for node in the upper right corner
3. Right-click it and uninstall it
Look again at the node
node -v
Copy the code
4. You can see that Node has been uninstalled, but don’t panic to ensure that node is completely deleted. Check to see if your node installation directory (default: C:\Program Files) still contains the node folder
5. Delete.npmrc and.yarnrc from C:\Users\ username
6. Check to see if any of your environment variables are node related, and delete them as well
2. Install the NVM
1. Go to Github and download the latest NVM. Go to NVM-setup.zip and click download
2. Decompress the installation package
3. Double-click Install to install it to the default path
4. Select the Node installation path
5. The installation is complete
6. On the terminal, check whether the installation is successful
nvm version
Copy the code
If the version number appears successfully, congratulations on your NVM installation
3. Install the Node
1. Go to the node official website to view the latest version and copy the latest version
2. Install the node version you copied
nvm install 14.151.
Copy the code
3. It can be seen that the installation failed because we failed to access this resource, don’t worry next open our NVM installation directory to find settings.txt
4. Double-click to add the source address of Taobao and save
node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/
Copy the code
5. Install the Node again
6. View the node list in the NVM
nvm list
Copy the code
7. Switch the node version to NVM use
nvm use 14.151.
Copy the code
8. If you look at the node list in NVM again, you will see an * in front of the version number. This * is your current node version
nvm list
Copy the code
9. Check the current node version and NPM version. You can see that the current node version is 14.15.1 and the NPM version is 6.14.8
node -v
npm -v
Copy the code
10. Go to the Node website and check out the 10.12.0 version numberVersion history
10. Install Node version 10.12.0
nvm install 10.12. 0
Copy the code
12. View the current node list
13. Switch the node version to 10.12.0 and check the node list to see that 10.12.0 is preceded by an extra *
14. Verify the current node version and NPM version. You can see that the node is successfully switched from 10.12.0 NPM to 6.4.1