npm i命令 报错 fatal: unable to access ‘https://github.com/nhn/raphael.git/‘: OpenSSL SSL_read: Conne...

错误1:
npm ERR! fatal: unable to connect to github.com
解决方案:

ssh访问切换为https访问

git config --global url."https://" .insteadOf git://

错误2:
fatal: unable to access 'https://github.com/nhn/raphael.git/': OpenSSL SSL_read: Connection was reset, errno 10054

原因:下载安装的依赖包太大,导致git请求超时了,可以通过修改git http.postBuffer的大小来解决此问题。

解决方案:

修改postBuffer值 注:524288000(500Mb)可以自己根据情况设置

git config --global https.postBuffer 524288000

若想要更直观的修改配置,可以直接打开配置文件进行修改

打开并编辑git配置文件

git config --edit --global

将如下内容添加至配置文件

[http]
    postBuffer = 524288000
[url "https://"]
    insteadOf = git://

特别注意:
由于Github位于外网,故改动后仍会因为网络原因造成install失败的几率,可以多尝试npm install几次,
其他相关问题大概率切换npm源能解决问题

 npm config set registry https://registry.npm.taobao.org

检测是否切换到了淘宝源

npm info underscore

为防止原文失效,转载此贴。原文链接:https://blog.csdn.net/wang306033/article/details/125201682
原作者:默默修炼

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容