nvm installation pitfalls

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:

  1. 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
  2. Double-click the uninstall node file and follow the prompts to uninstall node.
  3. 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
  4. Check whether there are node/npm related variables in the environment variables and delete them

Download and install nvm

  1. Search nvm-windows in github and jump to version history
  2. Download the latest nvm-setup.zip
  3. 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

  1. After the installation is complete, you can use nvm -v to check the version to determine whether nvm was successfully installed.
  2. 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.
  3. 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
  4. 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:

  1. Right-click the window icon in the lower left corner of the computer, and then click window powerShell (Administrator A)
  2. Then directly nvm use xxx in the pop-up command window and that’s it
    (step by step)

Guess you like

Origin blog.csdn.net/be_strong_web/article/details/121335232