AWS Elastic BeanStalk Node.js部署错误 [英] AWS Elastic BeanStalk nodejs Deployment error

查看:94
本文介绍了AWS Elastic BeanStalk Node.js部署错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近两天来,我陷入了一个非常奇怪的问题.我正在尝试在AWS Elastic beantalk上部署我的webpack nodejs应用程序.环境健康确定更改为降级.我已经部署了很多次,但是没有发生这样的问题.首先,查看日志:

I am stuck in a very weird issue from the last two days. I am trying to deploy my webpack nodejs app on AWS elastic beanstalk. The Environment Health changes from OK to Degraded. I have deployed it many times before but no such issue occurred. First of all, see the logs:

/var/log/eb-activity.log

/opt/elasticbeanstalk/containerfiles/ebnode.py --action节点安装活动执行失败,原因是:+/opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install

/opt/elasticbeanstalk/containerfiles/ebnode.py --action node-install Activity execution failed, because: + /opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install

npm ERR!小路/tmp/deployment/application/node_modules/grpc/node_modules/.bin/node-pre-gypnpm ERR!代码EEXIST npm ERR!拒绝删除/tmp/deployment/application/node_modules/grpc/node_modules/.bin/node-pre-gyp:在外面/tmp/deployment/application/node_modules/grpc/node_modules/node-pre-gyp而不是链接

npm ERR! path /tmp/deployment/application/node_modules/grpc/node_modules/.bin/node-pre-gyp npm ERR! code EEXIST npm ERR! Refusing to delete /tmp/deployment/application/node_modules/grpc/node_modules/.bin/node-pre-gyp: is outside /tmp/deployment/application/node_modules/grpc/node_modules/node-pre-gyp and not a link

npm ERR!文件已存在:/tmp/deployment/application/node_modules/grpc/node_modules/.bin/node-pre-gypnpm ERR!将其移开,然后重试.npm ERR!可以在以下位置找到此运行的完整日志:npm ERR!/tmp/.npm/_logs/2018-09-18T05_49_17_967Z-debug.log运行npm安装:/opt/elasticbeanstalk/node-install/node-v8.9.3-linux-x64/bin/npm
将npm config作业设置为1 npm config作业设置为1正在运行npm使用--production标志时,无法运行npm install.的快照日志更多细节.UTC 2018/09/18 05:49:17找不到应用程序npm调试日志位于/tmp/deployment/application/npm-debug.log追溯(最近一次通话):文件"/opt/elasticbeanstalk/containerfiles/ebnode.py",行695,在主要的()主目录中的文件"/opt/elasticbeanstalk/containerfiles/ebnode.py",行677node_version_manager.run_npm_install(options.app_path)在run_npm_install中的文件"/opt/elasticbeanstalk/containerfiles/ebnode.py",第136行self.npm_install(bin_path,self.config_manager.get_container_config('app_staging_dir'))npm_install中的文件"/opt/elasticbeanstalk/containerfiles/ebnode.py",第180行提高e subprocess.CalledProcessError:命令'['/opt/elasticbeanstalk/node-install/node-v8.9.3-linux-x64/bin/npm','--production','install']'返回非零退出状态1(ElasticBeanstalk :: ExternalInvocationError)

npm ERR! File exists: /tmp/deployment/application/node_modules/grpc/node_modules/.bin/node-pre-gyp npm ERR! Move it away, and try again. npm ERR! A complete log of this run can be found in: npm ERR! /tmp/.npm/_logs/2018-09-18T05_49_17_967Z-debug.log Running npm install: /opt/elasticbeanstalk/node-install/node-v8.9.3-linux-x64/bin/npm
Setting npm config jobs to 1 npm config jobs set to 1 Running npm with --production flag Failed to run npm install. Snapshot logs for more details. UTC 2018/09/18 05:49:17 cannot find application npm debug log at /tmp/deployment/application/npm-debug.log Traceback (most recent call last): File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 695, in main() File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 677, in main node_version_manager.run_npm_install(options.app_path) File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 136, in run_npm_install self.npm_install(bin_path, self.config_manager.get_container_config('app_staging_dir')) File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 180, in npm_install raise e subprocess.CalledProcessError: Command '['/opt/elasticbeanstalk/node-install/node-v8.9.3-linux-x64/bin/npm', '--production', 'install']' returned non-zero exit status 1 (ElasticBeanstalk::ExternalInvocationError)

现在该错误是某些 node-gyp 模块引起的,请相信我,我之前从未听说过.我正在寻找一种解决方案,以便我可以继续工作,因为在老板面前,这对我来说确实是一个令人尴尬的情况.您的帮助可以使我摆脱这种情况.

Now the error is of some node-gyp module and trust me I haven't heard it before. I am trying for a solution so that I can continue my work because this is really an embarrassing situation for me in front of my boss. Your help can get me out of this situation.

谢谢

推荐答案

我在各种节点模块上都遇到了相同的问题.当我使用 express init 创建了最初的NodeJs express项目时,这是一个简单的玩具项目.

I had the same problems with various node modules. It was a simple toy project were I created the initial NodeJs express project using express init.

我发现了许多有关将文件添加到.ebextensions文件夹中的帖子,并最终使用了该版本:

I found various posts about adding a file to the .ebextensions folder and ended up with this version:

在.ebextensions文件夹中创建一个名为 01_delete_node_modules.config 的文件,并添加以下内容:

Create a file called 01_delete_node_modules.config in the .ebextensions folder and add the following content:

文件:"/opt/elasticbeanstalk/hooks/appdeploy/pre/49_delete_node_modules.sh":模式:"000755"所有者:root组:根内容:#!/usr/bin/env bashsudo rm -rf/tmp/deployment/application/node_modules

乔什·哈里斯(Josh Harris)对此博客文章的怀疑: https://medium.com/@jharris.sf/npm-rebuild-elastic-beanstalk-and-permissionsbe1c6fceba9a

Cudos to this blog post by Josh Harris: https://medium.com/@jharris.sf/npm-rebuild-elastic-beanstalk-and-permissions-be1c6fceba9a

这篇关于AWS Elastic BeanStalk Node.js部署错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆