The introduction

The advantage of NVM is that it is convenient to manage the version of Node, and multiple versions can coexist.

1. Preparation

Uninstall the node completely before installation

2. Install

Making a link

The first kind of

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

The second,

Wget - qO - https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bashCopy the code

The environment variable

The script clones the nvm repository to ~/.nvm and adds the source line to your profile (~/.bash_profile, ~/.zshrc, ~/.profile, or~/.bashrc).

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
Copy the code

mac

  • brew install nvm

  • The environment variable

    # add nvm
    export NVM_DIR="$HOME/.nvm"
      [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"  # This loads nvm
      [ -s "/usr/local/opt/nvm/etc/bash_completion" ] && . "/usr/local/opt/nvm/etc/bash_completion"  # This loads nvm bash_completion
    Copy the code

windows

  • Refer to the link

3. Common commands

  • View the available Node versionsnvm ls-remote
  • View the installed Node versionnvm ls
  • Install other versions of NodeNVM install 8.9
  • View the node version in usenode --version
  • Switch to the Node versionNVM use 8.9.4
  • Uninstall a version of NodeNVM uninstall 0.11

This node series of software will be included on my Github: DC-Notes