NVM installation failed – solution!

Time:2021-7-30

Cause: if you want to replace the version of nodejs for some special reasons, the query tells you that you need to use NVM to manage and use commands to install

npm install nvm -g

!NVM installation failed - solution!

Failed!!!!!!!!!!!!!!!!!!!!!!!

Baidu has a solution: install and use NVM correctly

However, it got stuck when executing the order

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash

NVM installation failed - solution!

The solution is as follows:

Due to someYou know the factors, resulting in GitHub’sraw.githubusercontent.comDomain name resolution is contaminated.

stay https://www.ipaddress.com/ Query the real IP address of raw.githubusercontent.com.

NVM installation failed - solution!

Set VIM / etc / hosts in the host file

NVM installation failed - solution!

Execute command Download

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash

This prompts us to restart

NVM installation failed - solution!

After restarting, you can freely select the version of the command

NVM installation failed - solution!

NVM related commands

  • nvm install <version>##Install the specified version, which can be installed vaguely. For example, install v4.4.0, either NVM install v4.4.0 or NVM install 4.4
  • nvm uninstall <version>##Delete the installed specified version. The syntax is similar to install
  • nvm use <version>##Switch to use the specified version node
  • nvm ls##Lists all installed versions
  • nvm ls-remote##List the versions of all remote servers (official node version list)
  • nvm current##Displays the current version
  • nvm alias <name> <version>##Alias different version numbers
  • nvm unalias <name>##Delete a defined alias
  • nvm reinstall-packages <version>##In the node environment of the current version, reinstall the NPM package with the specified version number globally