繁体   English   中英

aws elastic beanstalk 部署了我的应用程序,但在下一次部署时抛出错误

[英]aws elastic beanstalk deploys my app but on next deployments throws an error

我是 aws beanstalk 的新手,这个问题让我很困惑。

  1. 首先我创建 eb 应用程序并使用他们的示例应用程序(节点 v16)
  2. 我下载eb cli
  3. 我使用 npx npx create-next-app@latest --typescript创建了一个 nextjs 应用程序
  4. 我用一行/node_modules创建了一个文件.ebignore
  5. 我运行npm run build然后测试它与npm run start一起工作
  6. 我运行eb init和 select 我的 eb 示例应用程序,然后我运行eb deploy

在第一次部署时,它会正确执行所有操作,并且我的应用程序已部署。

但是,然后我做了一个小的文本更改运行npm run build然后eb deploy ,在我的第二次尝试中我得到了错误:

2022-12-30 15:25:21    INFO    Environment update is starting.      
2022-12-30 15:25:26    INFO    Deploying new version to instance(s).
2022-12-30 15:25:29    INFO    Instance deployment: You didn't specify a Node.js version in the 'package.json' file in your source bundle. The deployment didn't install a specific Node.js version.
2022-12-30 15:25:46    ERROR   Instance deployment: 'npm' failed to install dependencies that you defined in 'package.json'. For details, see 'eb-engine.log'. The deployment failed.
2022-12-30 15:25:46    ERROR   Instance deployment failed. For details, see 'eb-engine.log'.
2022-12-30 15:25:49    ERROR   [Instance: i-08b3d32eff44fb29b] Command failed on instance. Return code: 1 Output: Engine 
execution has encountered an error..
2022-12-30 15:25:49    INFO    Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].        
2022-12-30 15:25:49    ERROR   Unsuccessful command execution on instance id(s) 'i-08b3d32eff44fb29b'. Aborting the operation.
2022-12-30 15:25:49    ERROR   Failed to deploy application.

当我请求eb-engine.log日志时,我得到:

2022/12/30 15:25:30.600993 [INFO] Running command /bin/sh -c npm --production install
2022/12/30 15:25:46.171460 [INFO] npm WARN config production Use `--omit=dev` instead.
npm ERR! code ENOMEM
npm ERR! syscall spawn
npm ERR! errno -12
npm ERR! spawn ENOMEM

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-12-30T15_25_30_951Z-debug-0.log

2022/12/30 15:25:46.171859 [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 exit status 244. Stderr:npm WARN config production Use `--omit=dev` instead.
npm ERR! code ENOMEM
npm ERR! syscall spawn
npm ERR! errno -12
npm ERR! spawn ENOMEM

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-12-30T15_25_30_951Z-debug-0.log
 

2022/12/30 15:25:46.171867 [INFO] Executing cleanup logic
2022/12/30 15:25:46.171975 [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: You didn't specify a Node.js version in the 'package.json' file in your source bundle. The deployment didn't install a specific Node.js version.","timestamp":1672413929779,"severity":"INFO"},{"msg":"Instance deployment: 'npm' failed to install dependencies that you defined in 'package.json'. For details, see 'eb-engine.log'. The deployment failed.","timestamp":1672413946171,"severity":"ERROR"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1672413946171,"severity":"ERROR"}]}]}

2022/12/30 15:25:46.174080 [INFO] Platform Engine finished execution on command: app-deploy
[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 exit status 244. Stderr:npm WARN config production Use `--omit=dev` instead.

不知道为什么它第一次部署它,但在我的其他尝试中却出错了。

问题是 Elastic Beanstalk 在运行npm install时耗尽了 memory。

将配置更改为t2.large ,运行eb deploy然后将配置更改回t2.micro & t2.small解决了这个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM