NPM update error - Fails to execute GIT

a 夏天 提交于 2019-12-13 17:42:02

问题


When I try to create a project I get the error below. It seems to be network related because it occurs only in company network. Any idea how to troubleshoot that?

D:\Projects\aurelia>au new test3

. . .

Installing project dependencies. npm ERR! git clone

--template=C:\Users\user\AppData\Roaming\npm-cache_git-r emotes_templates --mirror git://github.com/gulpjs/gulp.git

C:\Users\AppData\Roaming\npm-cache_git-remotes\git-github-com-gulpjs-gulp-git-4-0ecf98f08

: npm ERR! git clone

--template=C:\Users\user\AppData\Roaming\npm-cache_git-remotes_templates --mirror https://github.com/gulpjs/gulp.git

C:\Users\user\AppData\Roaming\npm-cache_git-remotes\git-https-github-com-gulpjs-gulp-git-40-4b46db44: npm ERR! git clone

--template=C:\Users\user\AppData\Roaming\npm-cache_git-remotes_templates --mirror git@github.com:gulpjs/gulp.git

C:\Users\user\AppData\Roaming\npm-cache_git-remotes\git-github-com-gulpjs-gulp-git-4-0-7c06e801:

UPDATE

This what I get when I run npm install

If I copy paste the git command that fails I get this:

error: SSL certificate problem, verify that the CA cert is OK. Details:error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://github.com/gulpjs/gulp.git/info/refs fatal: HTTP request failed

UPDATE

I added the missing certificate to git, and now I can run the git command by itself successfully. If I run npm install I still get an error. I also followed the advice of @Andrew and modified the git config file.


回答1:


Try configuring your git to use https instead of git. That seems to work more frequently inside work networks.
Type this command into your console:

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

Then you can try to create the project again, or just run npm install if it's already been created and it just failed on the dependency retrieval step.

Additionally, if that doesn't work, you might need to further specify when npm is using git with ssh. In this case, run this command as well: git config --global url."https://github.com/".insteadOf git@github.com:



来源:https://stackoverflow.com/questions/39386416/npm-update-error-fails-to-execute-git

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!