Skip to content

Mac m2 安装 nvm 报错

官网的命令

出现下面错误

https://github.com/nvm-sh/nvm#install--update-script

bash
shaohai.li@shaohailideMacBook-Pro ~ % curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (7) Failed to connect to raw.githubusercontent.com port 443 after 6 ms: Couldn't connect to server
shaohai.li@shaohailideMacBook-Pro ~ %

换成国内镜像

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

bash
shaohai.li@shaohailideMacBook-Pro ~ % curl -o- https://gitee.com/mirrors/nvm/raw/master/install.sh | bash

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 15916    0 15916    0     0  40788      0 --:--:-- --:--:-- --:--:-- 41340
=> Downloading nvm from git to '/Users/shaohai.li/.nvm'
=> Cloning into '/Users/shaohai.li/.nvm'...



fatal: unable to access 'https://github.com/nvm-sh/nvm.git/': LibreSSL SSL_read: error:02FFF03C:system library:func(4095):Operation timed out, errno 60
Failed to clone nvm repo. Please report this!

尝试关闭 Git 的 HTTP/2。Git 的 HTTP/2 有时候会导致连接问题。

你可以在命令行中输入以下命令来关闭 Git 的 HTTP/2:

bash
git config --global http.version HTTP/1.1