我对AWS CodeBuild有一个令人困惑的问题。我得到了以下错误:
Major version of alias '14.x' is not supported in runtime 'nodejs'
当我将buildspec更新为"14“时,我会得到关于错误的更多信息:
Message: Unknown runtime version named '14' of nodejs. This build image has the following versions: 10, 12
我们已经使用这个CodeBuild项目很长时间了,使用12.x,现在需要更新到14.x。我们更新了构建规范如下:
version: 0.2
phases:
install:
runtime-versions:
nodejs: 14.x
build:
commands:
- "npm i"
- "npm run build"
- "npm run db:migrate"
artifacts:
files:
- "all"
- "of"
- "our"
- "files"
此外,我们的CodeBuild已经在CodeBuild映像的最新版本上了。我甚至重新构建了CodeBuild项目,以确保它是最新的和仍然相同的问题:
aws/codebuild/amazonlinux2-x86_64-standard:3.0
提前感谢您的任何建议。
发布于 2021-12-03 16:03:34
谢天谢地,我们现在解决了这个问题!
问题在于CodeBuild图像:
aws/codebuild/amazonlinux2-x86_64-standard:3.0
根据可用运行时文档,我们根本不能使用Amazon 2,我们不得不更改为"Ubuntu 5“。
我希望这对将来的人有帮助。
发布于 2022-01-19 19:39:47
如果您绝对需要使用Amazon 2而不是Ubuntu,您可以使用预装的N包在CodeBuild中安装Node 14:
version: 0.2
phases:
install:
commands:
- n 14.18.3
build:
commands:
- npm i #etc
在我们的例子中,我们需要构建在Lambda中运行的依赖关系。由于Lambda运行的是Amazon 2版本,所以在Ubuntu中构建这些依赖项是行不通的(因为复杂的子依赖原因)。
试过但没有成功:
node --version
时,它仍然是12nvm
命令注册的问题然后,我们实现了已经在CodeBuild中预装了n。和管理节点版本。
最后,不需要复杂的命令。
发布于 2022-01-28 21:34:36
https://stackoverflow.com/questions/70205746
复制相似问题