[英]Cloud Assembly Schema Version Mismatch - Building A Code Pipeline In The CDK
After following the solution on github , and the solution on Stack Overflow , I am still experiencing the same issue when building a code pipeline with AWS CDK.在按照github 上的解决方案和 Stack Overflow 上的解决方案进行操作后,我在使用 AWS CDK 构建代码管道时仍然遇到同样的问题。
Error:错误:
This CDK CLI is not compatible with the CDK library used by your application. Please upgrade the CLI to the latest version.
(Cloud assembly schema version mismatch: Maximum schema version supported is 21.0.0, but found 22.0.0)
This error appears in the Code Build Stage of the Code Pipeline.此错误出现在代码管道的代码构建阶段。 Sourcing the code from Code Commit works successfully, as the first stage.
作为第一阶段,从 Code Commit 获取代码成功。
CDK Pipeline Code: CDK 流水线代码:
As you can see in the code below, I have the install commands of uninstalling the cdk, and then installing it again.正如您在下面的代码中看到的,我有卸载 cdk 的安装命令,然后重新安装它。 This was the recommended solution provided by the document above.
这是上面文档提供的推荐解决方案。 Re-ordering does not influence the outcome.
重新排序不影响结果。
this.codePipeline = new CodePipeline(this, `${environment}-${appName}-`, {
pipelineName: `${environment}-${appName}-`,
selfMutation: true,
crossAccountKeys: false,
role: this.codePipelineRole,
synth: new ShellStep("Deployment", {
input: CodePipelineSource.codeCommit(this.codeRepository, environment, {
codeBuildCloneOutput: true
}),
installCommands: ["npm uninstall -g aws-cdk", "npm i -g npm@latest", "npm install -g aws-cdk"],
commands: [
"cd backend",
"npm ci",
"npm run build",
"npx cdk synth",
],
primaryOutputDirectory: "backend/cdk.out",
})
});
Dependencies in the package.json
file: package.json
文件中的依赖:
"dependencies": {
"@aws-cdk/aws-appsync-alpha": "^2.55.1-alpha.0",
"aws-cdk-lib": "^2.58.0",
"aws-sdk": "^2.1278.0",
"constructs": "^10.1.204",
"git-branch": "^2.0.1",
"source-map-support": "^0.5.21"
}
The solution was to do without the npx
in npx cdk synth
.解决方案是在
npx cdk synth
中不使用npx
。 I removed it and the code worked.我删除了它并且代码有效。 This was also experienced when attempting to run
npx cdk synth
locally.尝试在本地运行
npx cdk synth
时也遇到过这种情况。
Solution: cdk synth
解决方案:
cdk synth
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.