最近调试安装vue-element-admin,执行
npm install
后报如下错误信息:
npm ERR! code 128
npm ERR! git dep preparation failed
npm ERR! command /Users/robin/.nvm/versions/node/v20.5.0/bin/node /Users/robin/.nvm/versions/node/v20.5.0/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/Users/robin/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm ERR! code 128
npm ERR! npm ERR! An unknown git error occurred
npm ERR! npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/adobe-webplatform/eve.git
npm ERR! npm ERR! git@github.com: Permission denied (publickey).
npm ERR! npm ERR! fatal: Could not read from remote repository.
npm ERR! npm ERR!
npm ERR! npm ERR! Please make sure you have the correct access rights
npm ERR! npm ERR! and the repository exists.
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in: /Users/robin/.npm/_logs/2023-07-22T14_57_16_187Z-debug-0.log
解决方法:
- 进入用户根目录下,打开.gitconfig文件,这里以Mac系统为例:
vim ~/.gitconfig
- 添加配置信息
- sslverify = false
- [url ""]根据自己的报错信息填写,我上面报错是拉取git文件ssh://git@github.com/adobe-webplatform/eve.git 报错,下面是具体修改示例:
[http] sslverify = false [url "https://git@github.com/adobe-webplatform/eve.git"] insteadOf = git@github.com/adobe-webplatform/eve.git
- 配置修改保存退出后,执行命令
npm config delete proxy
- 再次运行
npm install
,问题就可以解决了!