发新帖

[Vue2] Mac苹果电脑上安装nvm报一下错误:fatal: unable to access 'https://github.com/nvm-sh/nvm.git/': Error in the HTTP2 framing layer

零下一度 2月前 132

Mac苹果电脑上安装nvm报一下错误:fatal: unable to access 'https://github.com/nvm-sh/nvm.git/': Error in the HTTP2 framing layer


    1. 检查网络连接

      确保能正常访问GitHub。若网络受限,尝试切换网络(如使用手机热点)。


    禁用Git的HTTP2支持

    临时切换至HTTP/1.1协议:

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

    重新运行nvm安装命令,安装完成后可恢复默认设置:

    git config --global --unset http.version

    3、检查代理设置
    若使用代理,确保配置正确:

git config --global http.proxy  # 查看当前代理

若无需代理,取消设置:

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

4、关闭SSL验证(临时)
注意:此操作存在安全风险,仅在测试后恢复

git config --global http.sslVerify false

5、使用SSH协议克隆(需配置SSH密钥)

git clone git@github.com:nvm-sh/nvm.git ~/.nvm
cd ~/.nvm

git checkout v0.39.1  # 替换为最新版本号

将以下内容添加到~/.bashrc~/.zshrc

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

  • 刷新配置:source ~/.zshrc(或~/.bashrc)。

6、更新Git版本
使用Homebrew升级Git:

brew update && brew upgrade git

7、手动安装nvm
直接下载安装脚本:

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

8、检查系统时间和时区
确保系统时间准确:

date

若不准,在系统设置中调整或同步时间。

完成验证
安装后重启终端,执行:

nvm --version


输出版本号即表示成功。

若问题仍未解决,可能需要检查防火墙/VPN设置或联系网络管理员。







最新回复 (0)
返回
零下一度
主题数
931
帖子数
0
注册排名
1