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
posted @ 2023-11-10 11:47  leepandar  阅读(303)  评论(0编辑  收藏  举报