The node manager of the windows system
can freely switch the node version
Delete the original node
First, before installation, you need to uninstall the original node on the computer:
- Click the window icon in the lower left corner, enter node search directly, the node option will appear, and then click the Open in file button
- Double-click the uninstall node file and follow the prompts to uninstall node.
- Clear residual files. The approximate locations may be:
C:\Program Files (x86)\Nodejs
C:\Program Files\Nodejs
C:\Users{User}\AppData\Roaming\npm
C:\Users{User}\AppData\Roaming \npm-cache - Check whether there are node/npm related variables in the environment variables and delete them
Download and install nvm
- Search nvm-windows in github and jump to version history
- Download the latest nvm-setup.zip
- Next are the general steps for installing software.
Note: It is best not to have spaces, Chinese characters, etc. in the installation file path , otherwise an error may be reported when nvm use vxxx switches versions later (I have stepped on this pit personally T^T)
Download and install nvm
- After the installation is complete, you can use nvm -v to check the version to determine whether nvm was successfully installed.
- After the installation is successful, you can run nvm install xxx, where xxx is the version number you want, such as 16.13.0 or 14.18.1.
- After the install is successful, run nvm use xxx, (xxx is still the version number) You must execute this sentence to actually set the current node to the xxx version
- You can check the currently effective node and npm versions through node -v, npm -v
Note: When executing nvm use xxx, an error of no execution permission may be reported. This may be because you do not currently have administrator permissions. Generally, this will happen if a company computer has been added to a domain. At this time, you can do this:
- Right-click the window icon in the lower left corner of the computer, and then click window powerShell (Administrator A)
- Then directly nvm use xxx in the pop-up command window and that’s it
(step by step)