Install the NVM

Open MAC terminal type:

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

Verification: Enter NVM in the terminal. If Node Version Manager information is displayed, the installation is successful

Configure NVM environment variables

1 to enter the etc

2 Edit a profile

Since it is a system file, we will use sudo

Enter sudo vi profile

The code to configure is as follows:


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

After the configuration is complete, MY Profire file

After the edits are saved, enter source Profile for them to take effect

Common Commands

NVM install <version> ## Uninstall <version> ## Remove the installed version of NVM use NVM ls-remote ## NVM current ## show NVM alias <name> <version> ## Add alias NVM unalias <name> ## Delete the defined alias NVM scanted-packages <version> ## Re-install globally the NPM package NVM Alias with the specified version numberdefault[Node version] ## Set the default versionCopy the code

As follows: Current stable version is installed

Other versions can also be installed. Do not install the following versions of Node:

Install the NRM

 npm install -g  nrm    
Copy the code

View the source of the NRM

nrm ls

nrm ls
Copy the code

Switch the source

nrm use taobao
Copy the code

I won’t go into the rest