[英]Error while importing a node module from Gitlab private repository
Scenario: 场景:
Constraints are: 约束是:
So after googling for a couple of hours, I landed upon a solution, which involved including the dependecy directly from the git repository. 因此,在搜寻了几个小时之后,我找到了一个解决方案,该解决方案包括直接从git存储库中包含dependecy。
Thus my dependency looks like: 因此,我的依赖看起来像:
"my-module": "git+https://myusername:myaccesstoken@gitlab.com:Organization/Project.git#develop"
If I execute npm install
it would result in: 如果我执行
npm install
,它将导致:
npm ERR! Error while executing: npm ERR! /usr/bin/git ls-remote -h -t ssh://git@gitlab.com/organization/project.git npm ERR! npm ERR! Permission denied (publickey). 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! /home/username/.npm/_logs/2018-05-16T13_25_37_053Z-debug.log
Assuming you followed the steps to setup an access token as mentioned in this SO answer 假设您按照此SO答案中所述的步骤设置访问令牌
can you try removing the .git extension at the end of the project url, so it should look like 您可以尝试删除项目网址末尾的.git扩展名吗,所以它看起来应该像
"my-module": "git+https://myusername:myaccesstoken@gitlab.com:organization/project#develop"
so everything after @
should be the exact URL of the project on gitlab as you see in the address bar 因此
@
之后的所有内容都应该是gitlab上项目的确切URL,如您在地址栏中看到的那样
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.