小编典典

npm通过package.json中的依赖项安装私有github存储库

node.js

我正在尝试通过npm安装github私有存储库,其中包括其他私有github存储库作为依赖项。

尝试了很多方法和帖子,但是都没有用。这是我在做什么:

npm install git+https://github.com/myusername/mygitrepository.git

在package.json中就像:

"dependencies": {
    "repository1name": "git+https://github.com/myusername/repository1.git",
    "repository2name": "git+https://github.com/myusername/repository2.git"
}

正确的方法是什么?


阅读 681

收藏
2020-07-07

共1个答案

小编典典

以下在我需要的所有情况下都可以正常工作:

"dependencies": {
"GitRepo": "git+https://<token-from-github>:x-oauth-basic@github.com/<user>/<GitRepo>.git"
}
2020-07-07