简体   繁体   English

AWS Elastic Beanstalk NPM 部署错误

[英]AWS Elastic Beanstalk NPM error on deployment

I'm running my frontend on an AWS EC2 instance and use Code Pipeline to Deliver my code to deployment.我在 AWS EC2 实例上运行我的前端,并使用 Code Pipeline 将我的代码交付到部署。 While execution I get this error and my current build fails to execute beyond this point.执行时出现此错误,并且我当前的构建无法执行超出此点。 But in my local host everything works as expected.但是在我的本地主机中,一切都按预期工作。

Here's the error from my /var/log/eb-engine.log这是我的/var/log/eb-engine.log中的错误

2021/06/11 15:54:30.130038 [INFO] Running command /bin/sh -c npm config set jobs 1
2021/06/11 15:54:30.726850 [INFO] Running command /bin/sh -c npm --production install
2021/06/11 15:55:25.517929 [INFO] 
> ejs@2.7.4 postinstall /var/app/staging/node_modules/@surma/rollup-plugin-off-main-thread/node_modules/ejs
> node ./postinstall.js


2021/06/11 15:55:25.520296 [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:
 

2021/06/11 15:55:25.520730 [INFO] Executing cleanup logic
2021/06/11 15:55:25.529146 [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":1623426870,"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":1623426925,"severity":"ERROR"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1623426925,"severity":"ERROR"}]}]}

2021/06/11 15:55:25.535409 [INFO] Platform Engine finished execution on command: app-deploy

I am using a t2.micro instance on EC2.我在 EC2 上使用 t2.micro 实例。

It looks like the issue with npm install command in AWS instance.它看起来像 AWS 实例中 npm install 命令的问题。 Use npm install --only=prod (or --only=production).使用 npm 安装 --only=prod(或 --only=production)。 If npm version is greater than v3.3.0如果npm版本大于v3.3.0

Before v3.3.0 of npm (2015-08-13), the option was called --production, ie npm install --production. npm(2015-08-13)的v3.3.0之前,该选项被称为--production,即npm install --production。

We are getting this as well with npm v6.14 using node v14我们也使用节点 v14 使用 npm v6.14 得到这个

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

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