[AWS CodeBuild]引擎“节点”与此模块不兼容。预期版本&quot> = 14.0.0&quort。获得“ 10.19.0”
我正在尝试通过AWS Codepipeline和CodeBuild部署我的React应用程序。
但是,CodeBuild失败了以下错误:
[Container] 2022/04/19 02:42:19 Waiting for agent ping
[Container] 2022/04/19 02:42:29 Waiting for DOWNLOAD_SOURCE
[Container] 2022/04/19 02:42:30 Phase is DOWNLOAD_SOURCE
[Container] 2022/04/19 02:42:30 CODEBUILD_SRC_DIR=/codebuild/output/src234015054/src
[Container] 2022/04/19 02:42:30 YAML location is /codebuild/output/src234015054/src/buildspec.yml
[Container] 2022/04/19 02:42:30 Processing environment variables
[Container] 2022/04/19 02:42:30 [WARN] Skipping install of runtimes. Runtime version selection is not supported by this build image.
[Container] 2022/04/19 02:42:33 Moving to directory /codebuild/output/src234015054/src
[Container] 2022/04/19 02:42:33 Expanded cache path ./node_modules/**/*
[Container] 2022/04/19 02:42:33 Configuring ssm agent with target id: codebuild:0a77403f-035c-4d62-b96e-de5449f7f4bc
[Container] 2022/04/19 02:42:33 Successfully updated ssm agent configuration
[Container] 2022/04/19 02:42:33 Registering with agent
[Container] 2022/04/19 02:42:33 Phases found in YAML: 2
[Container] 2022/04/19 02:42:33 INSTALL: 2 commands
[Container] 2022/04/19 02:42:33 BUILD: 1 commands
[Container] 2022/04/19 02:42:33 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED
[Container] 2022/04/19 02:42:33 Phase context status code: Message:
[Container] 2022/04/19 02:42:33 Entering phase INSTALL
[Container] 2022/04/19 02:42:33 Running command echo Performing yarn install
Performing yarn install
[Container] 2022/04/19 02:42:33 Running command yarn install
yarn install v1.22.4
[1/5] Validating package.json...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=14.0.0". Got "10.19.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
我不知道为什么在此处选择CodeBuild 10.19.0
。
更多信息
我正在使用纱线构建
构建软件包的 。我可以使用纱线启动
运行该应用程序,而不会在本地出现问题。
这是我的buildspec.yml:
version: 0.2
phases:
install:
runtime-versions:
nodejs: 14
commands:
- echo Performing yarn install
- yarn install
build:
commands:
- yarn build
artifacts:
base-directory: ./build
files:
- "**/*"
cache:
paths:
- "./node_modules/**/*"
节点版本,
"name": "my-package",
"version": "0.1.0",
"private": true,
"engines": {
"node": ">=14.0.0",
"npm": ">=8.5.5"
},
我还指定了 package.json
:使用解决方案更新的
我可以根据FedOnev@的答案解决问题。
正如他所说,我需要配置构建映像以使用 codebuild.linuxbuildimage.standard_5_0
在CodeBuild项目中。
// AWS CodePipeline stage to build website
pipeline.addStage({
stageName: "Build",
actions: [
// AWS CodePipeline action to run CodeBuild project
new codepipeline_actions.CodeBuildAction({
actionName: "BuildeWebsite",
project: new CodeBuild.PipelineProject(this, "BuildWebsite", {
projectName: "BuildeWebsite",
environment: {
buildImage: CodeBuild.LinuxBuildImage.STANDARD_5_0
},
buildSpec:
CodeBuild.BuildSpec.fromSourceFilename("./buildspec.yml"),
}),
input: outputSources,
outputs: [outputWebsite],
}),
],
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您还必须配置CodeBuild项目以使用 支持Nodejs v14 Runtime 。 Ubuntu Standard 5图像是目前唯一的图像。在云形象中:
You must also configure the CodeBuild Project to use a build image that supports the Nodejs v14 runtime. The Ubuntu Standard 5 image is the only image that does at the moment. In CloudFormation: