我正在使用AWS Amplify,当我将react的代码推送到我的分支时,CI/CD运行并打开";npm安装";在AWS Amplify上构建失败,出现错误
npm2022-01-11t19:31:06.876Z[警告]:呃!执行时出错:npm ERR/usr/bin/git ls remote-h-tgit://github.com/danteata/passport-oauth.gitnpm ERR!npm ERR!致命:远程错误:npm ERR!不再支持端口9418上未经身份验证的git协议。npm ERR!请参阅https://github.blog/2021-09-01-improving-git-protocol-security-github/了解更多信息。npm ERR!npm ERR!退出,错误代码:128
我也尝试过回复git://git..具有https://git....在package-lock.json中(建议https://github.blog/2021-09-01-improving-git-protocol-security-github/)但是构建失败并出现相同的错误。
我们通过将git config --global url."https://".insteadOf git://
添加到构建规范amplify.yml preBuild命令中(就在npm install
之前(来克服这一问题。
见下文:
放大.yml
...
frontend:
phases:
preBuild:
commands:
- git config --global url."https://".insteadOf git://
- npm install
...