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



我是一个新手,这个问题让我很困惑。

  1. 首先,我创建了一个应用程序,并使用他们的样本应用程序(节点v16)
  2. 我下载eb cli
  3. 我使用npx create-next-app@latest --typescript创建了一个nextjs应用程序
  4. 我创建了一个文件.ebignore,行/node_modules
  5. 我运行npm run build,然后测试它是否与npm run start一起工作
  6. 我运行eb init并选择我的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时内存不足。

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

相关内容

  • 没有找到相关文章

最新更新