npm install 报错解决方法

npm install 命令报错

报错信息:

$ npm install --save git://github.com/howiefh/hexo-generator-calendar.git

npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config --get remote.origin.url

npm WARN addRemoteGit

npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:294:12)

npm ERR! code 128

npm ERR! Command failed: git -c core.longpaths=true clone --template=C:\Users\lxy\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/howiefh/hexo-generator-calendar.git C:\Users\lxy\AppData\Roaming\npm-cache\_git-remotes\git-github-com-howiefh-hexo-generator-calendar-git-dca6ee03

npm ERR! Cloning into bare repository 'C:\Users\lxy\AppData\Roaming\npm-cache\_git-remotes\git-github-com-howiefh-hexo-generator-calendar-git-dca6ee03'...

解决方法:

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

.gitconfig中会多出一行参数设置:

 [url "https://"] 

 insteadOf = git://

在终端进行clone,使用git://,或者http://去访问别人的repository,两种方式都会默认变成http://的形式进行连接,最终成功下载。

参考链接:git config详解  https://www.cnblogs.com/shoshana-kong/p/11003192.html

 

posted on 2020-06-27 17:33  溪因  阅读(676)  评论(0)    收藏  举报