报错信息:
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/*****.git
npm ERR! Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
原因分析:
install过程中某些包需要github.com的认证,而你本地的git配置了指向公司或者别处的url,导致失败,修改git的全局配置即可
解决办法:
先设置git配置文件编辑器
git config --global core.editor vim
编辑命令
git config --global edit
删除配置文件中多余的内容,使配置文件中最多包含以下内容(若您之前有其他配置,请先备份,这样配置是肯定能解决问题的)
[user]
name = xxx
email = xxxxxx@***.com
[core]
editor = vim
重新执行 npm install即可
文章讲述了npm安装过程中遇到的错误,由于git配置问题导致访问github.com时权限被拒绝。解决方法是更新git的全局配置,删除非必要的内容并设置正确的用户信息,然后重新执行npminstall。
1万+

被折叠的 条评论
为什么被折叠?



