2017-04-10 76 views
2

我在執行npm update時遇到了bower和npm問題。npm和bower更新大多數時間取決於網絡而失敗

jrquick$ npm update 
npm ERR! git fetch -a origin (ssh://[email protected]/[PRIVATE_PROJECT]/[PRIVATE_REPOSITORY].git) ssh_exchange_identification: read: Connection reset by peer 
npm ERR! git fetch -a origin (ssh://[email protected]/[PRIVATE_PROJECT]/[PRIVATE_REPOSITORY].git) fatal: Could not read from remote repository. 
npm ERR! git fetch -a origin (ssh://[email protected]/[PRIVATE_PROJECT]/[PRIVATE_REPOSITORY].git) 
npm ERR! git fetch -a origin (ssh://[email protected]/[PRIVATE_PROJECT]/[PRIVATE_REPOSITORY].git) Please make sure you have the correct access rights 
npm ERR! git fetch -a origin (ssh://[email protected]/[PRIVATE_PROJECT]/[PRIVATE_REPOSITORY].git) and the repository exists. 
npm ERR! Darwin 15.6.0 
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "update" 
npm ERR! node v6.3.0 
npm ERR! npm v3.10.8 
npm ERR! code 128 

npm ERR! Command failed: git fetch -a origin 
npm ERR! ssh_exchange_identification: read: Connection reset by peer 
npm ERR! fatal: Could not read from remote repository. 
npm ERR! 
npm ERR! Please make sure you have the correct access rights 
npm ERR! and the repository exists. 
npm ERR! 
npm ERR! 
npm ERR! If you need help, you may report this error at: 
npm ERR!  <https://github.com/npm/npm/issues> 

npm ERR! Please include the following file with any support request: 
npm ERR!  /Users/jrquick/[PRIVATE_PROJECT]/[PRIVATE_REPOSITORY]/npm-debug.log 

從我工作的網絡連接運行時,它會失敗,並且這個錯誤大部分都是時間。但是,我可以去星巴克或我的公寓,併成功運行相同的命令。

有關如何解決此問題的任何想法?我對網絡沒有任何控制權,但我認爲可能會改變數據包大小或在git或npm中設置某種類型的設置以避免這種情況。

謝謝。

+0

是否有可能到位桶已經阻止你的工作IP地址的另一個解決辦法是,看問題是否依然存在? –

+0

不,我從來沒有git命令的問題;克隆,拉等,它只發生在我的辦公室,表示更多的npm依賴關係比它更可能發生。這使我認爲網絡可能會丟失數據包或超時。但正如我所說,在我的家庭網絡工作。 – jrquick

+0

你的工作場所是否有很多人在做'npm update'?如果是這樣,你可能會被扼殺。你注意到這個錯誤只發生在bitbucket存儲庫中嗎? –

回答

1

如果這是一個節流閥的問題,因爲由mentionedJohn D.,理論溶液(如在「GitLab, NPM, and SSHd MaxStartups」提及)是增加的服務器的配置sshdMaxStartups值。

由於它是bitbucket.org,當然,您無權訪問該配置。

當使用HTTPS而不是SSH(使用自動將您的憑據,緩存由credential helper

git config --global url."https://bitbucket.org/".insteadOf [email protected]: 
+0

這看起來很有效。我使用了'git config --global url。「https://bitbucket.org/」.insteadOf ssh:// git @ bitbucket.org /'(略有不同),然後使用'git credential-osxkeychain'設置我的憑據和'git config --global credential.helper osxkeychain'。謝謝! – jrquick