A,nvm,node,npmThe difference between

  • NVM: NodeJS version management tool. In other words, an NVM can manage many node versions and NPM versions.

  • Nodejs: a library of code needed during project development.

  • NPM: NodeJS package management tool, which is installed when nodeJS is installed, NPM also installs with it. It is a package management tool, which manages third-party plug-ins in nodeJS.

Second,nvm,node,npmRelationship between

  • nvmmanagementnodejsnpmVersion,npmCan managenodejsThird party plug-ins.

Three, installation,nvm

  • NVM official documentation

  • Installation method 1: command installation (two options), but the network is not very good, has been stopped in the installation page no action, so the back of the manual installation.

    $curl - o - https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bashCopy the code

    or

    $wget - qO - https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bashCopy the code
  • Installation method 2: Manual installation

    Download the official Git NVM

    2. Decompress the installation file and find install.sh

    3. Run the following command to put the install.sh directory in the following command and press Enter to run the command.

    $ sh xxx/instal.sh
    Copy the code

    4, then wait, after the installation is complete, if the following red box appears, it indicates that the environment configuration is missing

    5. Copy the content in the red box and run it on the command line

    6. Install Run the following command to test whether the installation is successful

    $NVM or $NVM use systemCopy the code

Four, the use ofnvm

  • Install the latest stable version of Node, currently Node V12.9.1 (NPM v7.9.0)

    $ nvm install stable
    Copy the code
  • $NVM install v4.4.0 $NVM install v4.4.0 $NVM install 4.4

    $ nvm install <version>
    Copy the code
  • Deletes an installed version. The syntax is the same as install

    $ nvm uninstall <version>
    Copy the code
  • Switch to the specified version of Node

    $ nvm use <version>
    Copy the code
  • Lists all installed versions

    $ nvm ls
    Copy the code
  • List all remote server versions (official Node Version List)

    $ nvm ls-remote
    Copy the code
  • Displays the current version

    $ nvm current
    Copy the code
  • Add aliases to different version numbers

    $ nvm alias <name> <version>
    Copy the code
  • Delete a defined alias

    $ nvm unalias <name>
    Copy the code
  • In the current node version environment, reinstall the NPM package of the specified version globally

    $ nvm reinstall-packages <version>
    Copy the code
  • You can enter more commands on the terminal

    $ nvm
    Copy the code