npm ERR code 128 | 我的日常分享

npm ERR code 128

npm ERR code 128

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
npm ERR! code 128
npm ERR! git dep preparation failed
npm ERR! command C:\Program Files\nodejs\node.exe
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:
npm ERR! npm ERR! C:\Users\11977\AppData\Local\npm-cache\_logs\2022-05-10T06_58_38_613Z-debug.log

从git克隆下来的vue-element-admin安装依赖时报错。

解决方法:

找到C盘下的C:\Users\用户名\.gitconfig

添加配置:

  1. sslverify = false
  2. [url ""]根据具体情况添加,查看报错的模块地址npm ERR! npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/adobe-webplatform/eve.git将这个地址添加上去
1
2
3
4
5
6
7
8
[http]
sslverify = false
[url "https://git@github.com/adobe-webplatform/eve.git"]
insteadOf = git@github.com/adobe-webplatform/eve.git
[url "https://git@github.com/nhn/raphael.git"]
insteadOf = git://git@github.com/nhn/raphael.git
[url "https://git@github.com/adobe-webplatform/eve.git"]
insteadOf = git://git@github.com/adobe-webplatform/eve.git

以上配置完成后执行一下:否则不生效

1
npm config delete proxy

再次运行:

1
npm install --registry=https://registry.npm.taobao.org

问题解决:

image-20220510152331145

参考文章:

1、npm ERR code 128 npm ERR An unknown git error occurred npm ERR command git –no-replace-objects l

2、Git 代理 和 npm error code 128

3、https://blog.csdn.net/qq_37699336/article/details/119411507