mac安装nvm

如果安装过node,须得卸载

sudo npm uninstall npm -g

sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*

sudo rm -rf /usr/local/include/node /Users/$USER/.npm

sudo rm /usr/local/bin/node

sudo rm /usr/local/share/man/man1/node.1

sudo rm /usr/local/lib/dtrace/node.d

验证卸载成功

node -v //command not found
npm -v //command not found

1、nvm 官网 操作

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

发现报错

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

网络问题得,但是我没有墙翻,直接用国内镜像安装

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash -s -- --mirror=https://npm.taobao.org/mirrors/nvm

然后继续报错
在这里插入图片描述
继续修复报错
运行下列两条语句

git config --global --unset http.proxy
git config --global --unset https.proxy

然后继续安装,使用淘宝镜像安装,大功告成

你可能感兴趣的:(macos,nvm)