Elastic Beanstalk在没有有价值错误消息的情况下无法安装npm。

0

【以下的问题经过翻译处理】 我一直在尝试将一个 Node.js v16、npm v8 和 NestJS Api 部署到 AWS Elastic Beanstalk,但一直没有成功。它总是在调用 npm install 时停止,没有进一步的解释。

所使用的 EC2 实例是一个使用 AWS Linux 的 t4g.small 实例。这是我从日志文件中得到的唯一信息:

2022/04/06 12:17:27.564667 [INFO] Executing instruction: Use NPM to install dependencies
2022/04/06 12:17:27.564707 [INFO] use npm to install dependencies
2022/04/06 12:17:27.564755 [INFO] Running command /bin/sh -c npm config set jobs 1
2022/04/06 12:17:27.918363 [INFO] Running command /bin/sh -c npm --production install
2022/04/06 12:17:41.632070 [ERROR] An error occurred during execution of command [app-deploy] - [Use NPM to install dependencies]. Stop running the command. Error: Command /bin/sh -c npm --production install failed with error signal: killed 

2022/04/06 12:17:41.632467 [INFO] Executing cleanup logic
2022/04/06 12:17:41.643564 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment: 'npm' failed to install dependencies that you defined in 'package.json'. For details, see 'eb-engine.log'. The deployment failed.","timestamp":1649247461630,"severity":"ERROR"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1649247461633,"severity":"ERROR"}]}]}

2022/04/06 12:17:41.650817 [INFO] Platform Engine finished execution on command: app-deploy

有趣的是,当我在 AWS CodeBuild 中运行一切时,它完美地运行,但包含 node_modules 的构建

profile picture
专家
已提问 5 个月前30 查看次数
1 回答
0

【以下的回答经过翻译处理】 我知道现在已经有点晚了,但无论如何。

我也遇到了相同的问题:将应用程序成功部署到node v14的弹性beanstalk上,但在部署到node v16时失败,而且没有足够的错误信息提示。 问题的根因是内存不足。由于某种原因,npm v8(node v16 安装所关联的版本)在安装软件包时使用的内存比npm v6(node v14安装说关联的版本)更多。我还没有调查原因。

将等级从1GB RAM更改为2GB RAM解决了这个问题。

profile picture
专家
已回答 5 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则