有没有人遇到过CodebuildforNode14的最新版本是14.19.2,而EC2支持的节点14的最新版本是14.19.1。
由于Codebuild不支持指定次要版本,所以我只能使用14.19.2进行构建,然后在构建完成时无法部署,因为EC2中的节点版本不匹配。
Codebuild的日志:
> [Container] 2022/05/21 14:21:15 Running command echo "Installing
> Node.js version 14 ..." Installing Node.js version 14 ...
>
> [Container] 2022/05/21 14:21:15 Running command n $NODE_14_VERSION
> copying : node/14.19.2 installed : v14.19.2 (with npm 6.14.17)从部署到EC2的日志:
[1/5] Validating package.json...
2022-05-21T06:53:18.834-07:00 error my-app@0.1.2: The engine "node" is incompatible with this module. Expected version "14.19.1". Got "14.19.2"
2022-05-21T06:53:18.834-07:00 error Found incompatible module.发布于 2022-05-21 14:47:21
并不完美,但我改变了我的package.json以允许这两个版本,现在它构建和部署。
"engines": {
"node": "14.X"
},Codebuild支持比EC2更高的版本仍然很奇怪。
发布于 2022-06-17 02:27:26
我还没试过,但也许可以这样做。
# buildspec.yml
version: 0.2
phases:
install:
commands:
- n 14.19.1 # specify version
pre_build:
commands:
- node -v金融时报:https://blog.serverworks.co.jp/specific-nodejs-version-in-codebuild
https://stackoverflow.com/questions/72330481
复制相似问题