我正在尝试安装一个项目,并且在该项目的一个依赖项上收到npm 128错误代码。
npm install
npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\mingw64\bin\git.EXE ls-remote -h -t git@gitlab.mysite.com:myprivaterepo
npm ERR!
npm ERR! Permission denied, please try again.
npm ERR! Permission denied, please try again.
npm ERR! git@gitlab.mysite.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache\_logs\2020-07-13T12_19_31_285Z-debug.log
我通常将gitBash与ssh连接在后台运行的代理一起使用,我可以直接从具有依赖关系的gitLab存储库中克隆,但是我不能从使用npm install的主项目中克隆。 我还尝试执行抛出错误的命令,它可以正常工作:
git ls-remote --tags --heads git@gitlab.mysite.com:myprivaterepo
0099c1913ecc392394413554c5b22f2ea0b22b43 refs/heads/feature/generate-manifests
b67ca49f1d6ec9cf77ddd233a4f7b25d7a977d75 refs/heads/master
8787a2dafbfebef21a9cf77c8081b745979e76fe refs/heads/refactor/use-docker-compose-pull
70ee2ca3e44b6dedb4d4cf3984cec20dcf3283be refs/tags/1.0.0
9260ee68b9fd4972f18a51dc7c21d2a8559bc51e refs/tags/1.0.0^{}
fa44564e49035b5c1eecaeb9092332e60b5dfa0a refs/tags/1.0.1
0c3ef1ec8621614c83668841a69769c496d74ee4 refs/tags/1.0.1^{}
86a351644be3994f0bcd8b4cdbd2b9721d296440 refs/tags/1.0.2
f5c24db1d09cc3d35aa35816b8ad5528c60b6d79 refs/tags/1.0.2^{}
cc0b8bf529390eb9c1137aeeee82925b3f37c985 refs/tags/1.0.3
3002e6cce768eff4bdb6872b7856763065e0f545 refs/tags/1.0.3^{}
37fbaa00a3ffe116113af98243bb5abffd4e7d3a refs/tags/1.0.4
fac2008469dd9c1bb20b5a3d811586ee04527664 refs/tags/1.0.4^{}
d209098860a9f6f6b562431a065500bff2b2702f refs/tags/1.0.5
b67ca49f1d6ec9cf77ddd233a4f7b25d7a977d75 refs/tags/1.0.5^{}
我也试过纱线,我也遇到同样的问题。 还尝试了从最新版本到8.0.0的不同节点版本,或者尝试从头节点和npm删除并重新安装。
这是我的package.json:
{
"name": "my-project",
"version": "1.0.0",
"description": "",
"main": "app/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "ssh://git@gitlab.mysite.com/myproject/myfolder"
},
"keywords": [
"my-keyword"
],
"author": "my@email.com",
"license": "mylicense",
"dependencies": {
"my-dependency": "git+ssh://git@gitlab.mysite.ch:my-repo/my-folder/my-repo",
"lodash": "^3.10.1",
"xml2js": "0.4.17"
}
}
有人对出什么问题有任何暗示吗?
答案 0 :(得分:0)
Francesco,您好,欢迎光临!
我认为问题在于npm执行的git进程超出了您的Git Bash(MinGW)的范围。看起来npm在纯Windows上下文中执行git.exe
,因此它对您的MinGW环境一无所知。我建议您将ssh键分别放在Git Bash的~/.ssh
和Windows的%USERPROFILE%\.ssh
中。或在MinGW端创建符号链接。