当我执行 npm update
时,我遇到了 bower 和 npm 的问题。
jrquick$ npm update
npm ERR! git fetch -a origin (ssh://git@bitbucket.org/[PRIVATE_PROJECT]/[PRIVATE_REPOSITORY].git) ssh_exchange_identification: read: Connection reset by peer
npm ERR! git fetch -a origin (ssh://git@bitbucket.org/[PRIVATE_PROJECT]/[PRIVATE_REPOSITORY].git) fatal: Could not read from remote repository.
npm ERR! git fetch -a origin (ssh://git@bitbucket.org/[PRIVATE_PROJECT]/[PRIVATE_REPOSITORY].git)
npm ERR! git fetch -a origin (ssh://git@bitbucket.org/[PRIVATE_PROJECT]/[PRIVATE_REPOSITORY].git) Please make sure you have the correct access rights
npm ERR! git fetch -a origin (ssh://git@bitbucket.org/[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 中进行某种类型的设置来避免这种情况。
谢谢。
最佳答案
如果这是节流问题,如 mentioned通过 John D. ,理论上的解决方案(如“GitLab, NPM, and SSHd MaxStartups”中所述)是增加服务器的 sshd
配置的 MaxStartups
值。
因为它是 bitbucket.org,您当然无权访问该配置。
另一种解决方法是查看在使用 https 而不是 ssh 时问题是否仍然存在(并自动使用您的凭据,由 credential helper 缓存)
git config --global url."https://bitbucket.org/".insteadOf git@bitbucket.org:
关于git - npm 和 bower 更新大部分时间都失败,具体取决于网络,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43326527/