我也不太知道原因,没有找到原因,但是有很多的人说不要用brew安装,我是直接去nvm的git下 看的安装方法。
- curl
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
- wget
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
安装的时候可能会提示下载失败的情况,需要终端代理,才行
下载完后,需要在bash 或者zshell,文件中添加 变量和直接的脚本,位置在:
~/.bash_profile
、 ~/.zshrc
、 ~/.profile
、 ~/.bashrc
。
这几个配置的区别可以查看 这里
这个四个文件其中一添加执行文本
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm