【以下的问题经过翻译处理】 我一直在尝试将一个 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 的构建