First, delete node.js, uninstall it cleanly
, and then install nvm (node version management tool)
1. Download
Download link: https://github.com/coreybutler/nvm-windows/releases
Pull down to find the place to download
nvm-noinstall.zip: It is not recommended to install without installation. I have not configured it well. It has been a long time.
nvm-setup.zip: The installation version is recommended.
2. Installation
attention: installation warning! ! !
By default, this path C:\Program Files
has spaces in it! There should be no Chinese and spaces
in the file name , so the entire plain English here does not have any spaces
This is my directory path
1. Double-click nvm-setup.exe
2. Accept the agreement
3. Select the installation path of nvm
4. Select the nodeks installation path
5. Confirm the installation
and check whether the installation is successful. Window+R input cmd
input nvm
will display the installation version and related commands.
At this time, the nvm installation is successful. Now you can install different node.js installations. You need to install from the lower version
3. Start using nvm
1. nvm list
Command - display version list
nvm list // 显示已安装的版本(同 nvm list installed)
nvm list installed // 显示已安装的版本
nvm list available // 显示所有可以下载的版本
2. nvm install xx.x.x
Command - install the specified version node.js
nvm install 14.5.0 // 安装14.5.0版本node
nvm install latest // 安装最新版本node
3. nvm use
Command - use the specified version node
nvm use 14.5.0 // 使用14.5.0版本node
4. uvm unistall
Command - Uninstall the specified version node
nvm uninstall 14.5.0 // 卸载14.5.0版本node
5. This is what I am currently using.
6. nvm on
Turn on node.js version management.
I don’t know why there are garbled characters after typing, but it doesn’t affect it.
Reference: If you have any questions, you can click the
link
4. Configure the environment (this is what I added separately in case there are friends who can’t configure the environment like me)
1. Find the environment configuration place like I can’t find it. sysdm.cpl
2. Enter the environment variable 3. Create a new variable name
in the following system variables : NODE_PATH variable value: your node.js version number there 4. In the red box 5. Edit in the Path in the above user variable 6. Create a new one like me and come out 7. Confirm and save all the way. Finally, test whether the node is configured in cmd. If you need to switch to another version Just change it in this variable path. I read others that you can use nvm to switch the variable path to switch versions, but I am in a hurry here, so I didn’t check it. If anyone knows, please let me know. Thank you very much.
node-v