我有一个 Nest.js (Node.js) 应用程序,我想将其部署在 ElasticBeanstalk(Node 16 版本,AL2 5.5.0)上。
我的部署一直失败,我发现错误在eb-engine.log
.
...
2022/03/23 15:11:48.570759 [INFO] Executing instruction: StageApplication
2022/03/23 15:11:48.570846 [INFO] extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/
2022/03/23 15:11:48.570860 [INFO] Running command /bin/sh -c /usr/bin/unzip -q -o /opt/elasticbeanstalk/deployment/app_source_bundle -d /var/app/staging/
2022/03/23 15:11:49.274806 [INFO] finished extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/ successfully
2022/03/23 15:11:49.289272 [INFO] Executing instruction: RunAppDeployPreBuildHooks
2022/03/23 15:11:49.289292 [INFO] Executing platform hooks in .platform/hooks/prebuild/
2022/03/23 15:11:49.289306 [INFO] The dir .platform/hooks/prebuild/ does not exist
2022/03/23 15:11:49.289311 [INFO] Executing instruction: Install customer specified node.js version
2022/03/23 15:11:49.289314 [INFO] installing specified nodejs version...
2022/03/23 15:11:49.289467 [INFO] there is no nodejs version specified in package.json, skip installing specified version of nodejs
2022/03/23 15:11:49.289476 [INFO] Executing instruction: Use NPM to install dependencies
2022/03/23 15:11:49.289484 [INFO] use npm to install dependencies
2022/03/23 15:11:49.289505 [INFO] Running command /bin/sh -c npm config set jobs 1
2022/03/23 15:11:49.574486 [INFO] Running command /bin/sh -c npm --production install
2022/03/23 15:12:06.913580 [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
...
我认为在生产模式下安装 npm 包时会发生错误,但我真的很想知道为什么会发生这种情况。我执行了npm --production install
在我的本地计算机中,使用完全相同版本的 Node 和 npm 安装成功。 (目前最新的是 Node 16.14.0、npm 8.3.1 - AL2 5.5.0)。
我想知道为什么会发生这种情况以及如何调试更多细节(为什么npm install在elastic beanstalk环境中失败)。
我遇到了同样的问题,我能找到解决该问题的唯一方法是增加运行应用程序的实例的大小。为了让它工作,我必须使用t2.medium
.
您还可以尝试增加运行应用程序的 EC2 实例的交换,但根据我的经验,这会使部署过程花费太长时间,有时甚至会失败。 (看这个答案 https://stackoverflow.com/questions/62626724/how-do-i-configure-linux-swap-space-on-aws-elastic-beanstalk-running-aws-linux-2如果你想尝试这种方法)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)