Don’t you know how to manage nodes using NVM

background

A colleague asked me to help him look at the problem of project packaging error. Later, after testing, it was found that the node version of his side was too high, then he said that the reduced version needed to uninstall, so he gave him a wave of NVM.

NVM is introduced

NVM is a node version management tool that can create an isolated environment for different versions of Nodes to avoid interference with each other’s package versions. If you are responsible for several projects, each with different requirements, different projects must rely on different versions of the NodeJ environment. Official Github introduction

NVM use

  1. View the node installation directory using which node
  2. Delete node and node_modules files and folders in this directory
  3. For nodes installed through Brew Intsall Node, run brew Uninstall node on the terminal to uninstall the node
  1. The curl way
The curl - o - https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bashCopy the code
  1. Wget way
Wget - qO - https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bashCopy the code

Use nVM-V to check whether the installation is successful. If a note is displayed, the installation is successful

  1. NVM Install Node installs the latest version of Node
  2. NVM install v12.7.0 will install Node 12.7.0
  3. NVM uninstall v12.7.0 Uninstalls Node 12.7.0
  4. NVM ls View the installed Node version
  5. NVM use v12.7.0 Switch 12.7.0 to the current version
  6. NVM Alias Default v12.7.0 Sets 12.7.0 to the default version of Node
  7. NVM which v12.7.0 View the installation directory of Node 12.7.0
  8. NVM –help see more command usage

Results demonstrate

Look, isn’t that much easier? It smells good. Don’t you want to try it