How to install Mac: node's multi-version management tool (nvm or n)

One, nvm

The 3 steps of installation are as follows (prerequisite: the node downloaded separately from the computer needs to be deleted first):

(1) Enter the following command in the terminal of the root directory of the Mac to download nvm (version 0.37.0):

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

(2) Command to check whether nvm is successfully installed:

    nvm --version

(3) Use nvm to install a certain version of node: (Note: when installing node, the system will also automatically install the corresponding npm)

nvm install v12.22.0 or nvm install 14.10.0

Two, n 

Official website documentation: n - npm

// 常用命令
npm install n -g  // 全局安装 n
n <version> // 安装node版本,如 n 14.10.0

other extensions

1. When using nvm install xx to install node, an error is reported: "clang: error: no such file or directory: 'CXX=c++'"

Answer: First enter the command in the terminal: arch -x86_64 zsh , and then enter the command to install node: nvm install xxx.

2. Commonly used Mac terminal commands:

Switch to the system root directory: cd

Switch to the nvm directory: cd .nvm

View the installation directory path of node: which node

Reference URL:

Guess you like

Origin blog.csdn.net/qq_38969618/article/details/124623632