我正在尝试安装我们私有(private)仓库中存在的软件包。目标是与合作伙伴共享存储库,但我需要确保他们可以安装它。从理论上讲,它应该可以工作,但是没有一个记录在案的解决方案对我有用
我尝试将包添加到 package.json 文件
"dependencies": {
"package_name": "git+https://<deploy-token-name>:<deploy-token>@gitlab.domain.com/group/repo.git"
}
然后用 npm 安装,但似乎在部署 token 上失败了,但很难说,因为日志不是很有帮助,然后我们的整个 gitlab 部署暂时停止了#fun
29 error
29 error undefined
29 error exited with error code: 128
我也尝试过使用私有(private)访问 token
"package-name": "https://oauth2:<access-token>@gitlab.domain.com/group/repo.git"
这导致了一个我可以理解的实际错误,除了错误是说存储库中没有 package.json,但肯定有
npm ERR! package.json Non-registry package missing package.json: package-name@https://oauth2:<access-token>@gitlab.domain.com/group/repo.git.
npm ERR! package.json npm can't find a package.json file in your current directory.
我尝试过使用 ssh(使用适用于提交等的 ssh key 设置)
git+ssh://git@my-domain.com:my-project/my-repo#my-branch
这会导致错误
npm ERR! premature close
我已经阅读了十几个相关的问题和文章,但没有什么对我有用
最佳答案
我有同样的问题,我设法解决它。
我要安装的 gitlab 存储库没有 package.json
文件。
关于reactjs - 从私有(private) gitlab 存储库中使用 npm 安装依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54404760/