CodeBuild最新节点版本与EC2不匹配

发布于 2025-01-30 23:54:33 字数 943 浏览 5 评论 0原文

是否有人遇到过这个问题,即CodeBuild的节点14的最新版本为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 [email protected]: 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.

Has anyone run into the issue that Codebuild's latest version for node 14 is 14.19.2 but EC2's latest supported version of node 14 is 14.19.1.

Since Codebuild doesn't support specifying minor version, I'm stuck at building with 14.19.2 and then can't deploy when the build finishes because the node version in the EC2 is mismatched.

Logs from 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)

Logs from deploy to EC2:

[1/5] Validating package.json...

2022-05-21T06:53:18.834-07:00   error [email protected]: 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

篱下浅笙歌 2025-02-06 23:54:33

并不完美,但是我更改了包装。JSON允许两个版本,现在它可以构建和部署。

"engines": {
  "node": "14.X"
},

CodeBuild会支持EC2更高版本仍然很奇怪。

Not perfect, but I changed my package.json to allow both versions and now it builds and deploys.

"engines": {
  "node": "14.X"
},

It's still weird that Codebuild would support a higher version that EC2.

娇女薄笑 2025-02-06 23:54:33

我还没有尝试过,但是也许可以做到这一点。

# buildspec.yml
version: 0.2
phases:
  install:
    commands:
      - n 14.19.1 # specify version
  pre_build:
    commands:
      - node -v

FYI: https://blog.serverworks.co.jp/specific- nodejs-version-in-codebuild

I haven't tried it yet, but maybe this way it could be done.

# buildspec.yml
version: 0.2
phases:
  install:
    commands:
      - n 14.19.1 # specify version
  pre_build:
    commands:
      - node -v

FYI: https://blog.serverworks.co.jp/specific-nodejs-version-in-codebuild

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文