brew安装nvm、node及配置
用brew安装nvm
brew install nvm
创建nvm的工作目录
mkdir ~/.nvm
配置环境变量
vim ~/.bash_profile
## 添加配置
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
## 退出后
source ~/.bash_profile
查看版本
nvm -v
配置镜像
接下来配置nvm镜像,在.bash_profile,添加
export NVM_NODEJS_ORG_MIRROR=http://mirrors.cloud.tencent.com/nodejs-release/
安装node
nvm install 16.17.1