我正在尝试使用自托管(在 bitbucket 中)npm 包。我能够在本地使用它而没有任何问题,但是在运行 bitbucket 管道时出现错误。它在 npm install 步骤中失败。
这是我使用私有 npm 包在 repo 上的内容:
...
"dependencies": {
"shared-lib": "ssh://git@bitbucket.org/{org-name}/shared-lib.git"
...
}
两个存储库都在 bitbucket 中的同一组织(私有)下。
在使用自托管私有 npm 包的库上,我通过以下操作创建了一个密钥:设置 > 管道 > SSH 密钥(bitbucket 上的自生成密钥)
在共享库上,我通过转到设置 > SSH 密钥 > 添加密钥(自行生成)添加了这个 SSH 密钥。
还添加了 bitbucket.org 作为已知地址。
目前bitbucket-pipelines.yml
没有任何特殊配置,我只是在运行npm install
(失败的地方)和npm run test
.
这是我的配置,但在运行管道时仍然失败。
这是运行管道时的错误:
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno ENOENT
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git@bitbucket.org/{org-name}/shared-lib.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent```