錯(cuò)誤1:
npm ERR! fatal: unable to connect to github.com
解決方案:
ssh訪問切換為https訪問
git config --global url."https://" .insteadOf git://
錯(cuò)誤2:
fatal: unable to access 'https://github.com/nhn/raphael.git/': OpenSSL SSL_read: Connection was reset, errno 10054
原因:下載安裝的依賴包太大,導(dǎo)致git請(qǐng)求超時(shí)了鹦倚,可以通過修改git http.postBuffer的大小來解決此問題河质。
解決方案:
修改postBuffer值 注:524288000(500Mb)可以自己根據(jù)情況設(shè)置
git config --global https.postBuffer 524288000
若想要更直觀的修改配置,可以直接打開配置文件進(jìn)行修改
打開并編輯git配置文件
git config --edit --global
將如下內(nèi)容添加至配置文件
[http]
postBuffer = 524288000
[url "https://"]
insteadOf = git://
特別注意:
由于Github位于外網(wǎng),故改動(dòng)后仍會(huì)因?yàn)榫W(wǎng)絡(luò)原因造成install失敗的幾率,可以多嘗試npm install幾次,
其他相關(guān)問題大概率切換npm源能解決問題
npm config set registry https://registry.npm.taobao.org
檢測是否切換到了淘寶源
npm info underscore
為防止原文失效,轉(zhuǎn)載此貼。原文鏈接:https://blog.csdn.net/wang306033/article/details/125201682
原作者:默默修煉