我的Docker文件中读取RUN yarn install --frozen-lockfile
的步骤在.github操作中执行时失败,并显示以下错误文本。
它读起来好像运行git ls remote --tags --heads ssh://git@github.com/reach-sh/js-conflux-sdk.git
有问题,这似乎进一步表明"ssh:未找到">
"ssh"肯定存在于构建环境中,并且reach-sh/js-conflux-sdk
repo不是私有的。我无法在本地机器上复制此内容。我错过了什么?
#10 [builder 6/7] RUN yarn install
#10 sha256:0241e5ad2b01044255a03052e8f2a2540c5fb45a447a1b93c55b90ed86436440
#10 10.84 yarn install v1.22.17
#10 11.81 [1/4] Resolving packages...
#10 12.75 [2/4] Fetching packages...
#10 13.13 error Command failed.
#10 13.13 Exit code: 128
#10 13.13 Command: git
#10 13.13 Arguments: ls-remote --tags --heads ssh://git@github.com/reach-sh/js-conflux-sdk.git
#10 13.13 Directory: /apps/launchpad-api
#10 13.13 Output:
#10 13.13 "ssh" -oBatchMode=yes: line 1: ssh: not found
#10 13.13 fatal: Could not read from remote repository.
#10 13.13
#10 13.13 Please make sure you have the correct access rights
#10 13.13 and the repository exists.
#10 13.13 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
#10 ERROR: executor failed running [/bin/sh -c yarn install]: exit code: 128
------
> [builder 6/7] RUN yarn install:
------
executor failed running [/bin/sh -c yarn install]: exit code: 128
我已经尝试将ssh显式安装到构建容器中,该容器报告ssh已经安装。
我已经检查过git ls-remote --tags --heads ssh://git@github.com/reach-sh/js-conflux-sdk.git
可以在没有任何特殊权限的情况下从本地计算机上运行。
我试着删除并重新构建我的yarn.lock文件,但没有做任何不同的事情。
我在Reach GitHub存储库中报告了这个问题。
之所以会发生这种情况,是因为js-conflux-sdk
的版本(stdlib
依赖项之一(被指定为js-conflux-sdk@git+https://github.com/reach-sh/js-conflux-sdk.git#v1_6_0_blockNumber
。
这使得构建脚本使用SSHssh://git@github.com/reach-sh/js-conflux-sdk.git
克隆repo,由于缺少SSH密钥,该脚本在CI容器上失败。
这个问题可以暂时解决在package-lock.json
中用https://
替换ssh://git@
并运行npm ci
或yarn install --frozen-lockfile
。
我想这个问题的根源是这句话。
该版本是参考github存储库指定的,在生成package-lock-json
时使用ssh://git@
解析该存储库。
感谢您的回复!我最终解决了这个问题,没有删除锁定文件,而是使用简单的yarn install
运行,但我相信在您发表评论后,我现在对这个问题有了更好的了解。