简体   繁体   English

在弹性 beanstalk 上部署多容器 docker 应用程序:找不到 webpack 命令

[英]Deploying a multi-container docker application on elastic beanstalk: webpack command not found

I have a simple app consisting in a few containers behind an nginx reverse proxy.我有一个简单的应用程序,包含几个位于nginx反向代理后面的容器。 App is written in javascript and I used webpack for both front-end and back-end and additional modules.应用程序是用 javascript 编写的,我将webpack用于前端和后端以及附加模块。 . . Webpack is listed in devDependencies . Webpack列在devDependencies中。 I am trying to deploy this app on AWS elasticbeanstalk (at which I am totally new) in a Docker environment running on 64bit Amazon Linux 2/3.2.0 and I am facing this error:我正在尝试在运行于64bit Amazon Linux 2/3.2.0上的Docker环境中的 AWS elasticbeanstalk (我是全新的)上部署此应用程序,我面临此错误:

...
somecontainer_1  | npm ERR! A complete log of this run can be found in:
somecontainer_1  | npm ERR!     /root/.npm/_logs/2020-10-19T21_35_51_966Z-debug.log
somecontainer_1  | 
somecontainer_1  | > fibworker@1.0.0 start /app
somecontainer_1  | > webpack --watch
somecontainer_1  | 
somecontainer_1  | sh: webpack: not found
somecontainer_1  | npm ERR! code ELIFECYCLE
somecontainer_1  | npm ERR! syscall spawn
somecontainer_1  | npm ERR! file sh
...

elasticbeanstalk runs npm install in production mode, so using some configuration I should be able to make elasticbeanstalk to install devDependencies and use webpack . elasticbeanstalk在生产模式下运行npm install ,因此使用一些配置我应该能够让elasticbeanstalk安装devDependencies并使用webpack I searched docs and read posts here and there.我到处搜索文档并阅读帖子。 I tried to:我尝试过了:

  • set the environment NPM_USE_PRODUCTION to false,将环境NPM_USE_PRODUCTION设置为 false,
  • add the following ./ebextensions/something.config :添加以下./ebextensions/something.config
option_settings:
  - namespace: aws:elasticbeanstalk:environment
    option_name: NPM_USE_PRODUCTION
    value: false
  • use the ./ebextensions/something.config suggested here .使用此处建议的./ebextensions/something.config I guess I that was the right way, but causes deploy to fail with this error:我想那是正确的方法,但会导致部署失败并出现此错误:
    2020-10-19 21:26:40,329 [ERROR] Command npmglobals (sudo -u webapp npm i) failed
    2020-10-19 21:26:40,329 [ERROR] Error encountered during build of postbuild_0_fibsequence: Command npmglobals failed
    Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 542, in run_config 
    CloudFormationCarpenter(config, self._auth_config).build(worklog)
      File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 260, in build
    changes['commands'] = CommandTool().apply(self._config.commands)
      File "/usr/lib/python2.7/site-packages/cfnbootstrap/command_tool.py", line 117, in apply
    raise ToolError(u"Command %s failed" % name)
    ToolError: Command npmglobals failed
    2020-10-19 21:26:40,331 [ERROR] -----------------------BUILD FAILED!------------------------
    2020-10-19 21:26:40,331 [ERROR] Unhandled exception during build: Command npmglobals failed
    Traceback (most recent call last):
      File "/opt/aws/bin/cfn-init", line 171, in <module>
        worklog.build(metadata, configSets)
      File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 129, in build
        Contractor(metadata).build(configSets, self)
      File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 530, in build
    self.run_config(config, worklog)
      File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 542, in run_config
    CloudFormationCarpenter(config, self._auth_config).build(worklog)
      File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 260, in build
    changes['commands'] = CommandTool().apply(self._config.commands)
      File "/usr/lib/python2.7/site-packages/cfnbootstrap/command_tool.py", line 117, in apply
    raise ToolError(u"Command %s failed" % name)

No luck.没有运气。 What am I missing?我错过了什么?

Well what I miss is that AWS (at the time I was struggling against) does not care about dev dependencies of your node project, so my app does not fit.好吧,我想念的是 AWS(当时我正在努力反对)不关心你的节点项目的开发依赖性,所以我的应用程序不适合。

暂无
暂无

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

相关问题 Elastic Beanstalk上的HTTPS(Docker多容器) - HTTPS on Elastic Beanstalk (Docker Multi-container) 通过 awsebcli 在 Elastic Beanstalk(多容器 Docker)中使用自定义 AMI - Using customized AMI in Elastic Beanstalk (Multi-container Docker) via awsebcli 何时在Elastic Beanstalk中使用多容器Docker运行Rails应用程序? - When to use a multi-container docker in Elastic Beanstalk for running a Rails App? 如何将特定日志文件从多容器Docker Elastic Beanstalk流式传输到CloudWatch? - How can I stream a specific log file from multi-container Docker Elastic Beanstalk to CloudWatch? 对于 AWS Elastic Beanstalk 中的多容器 Docker 配置,增强型运行状况概览未正确报告 - Enhanced Health Overview not reporting properly for Multi-container Docker configuration in AWS Elastic Beanstalk AWS Fargate 和多容器 Elastic Beanstalk 之间的区别? - Differences between AWS Fargate and multi-container Elastic Beanstalk? 处理AWS Elastic Beanstalk多容器数据库和持久存储 - Dealing with AWS Elastic Beanstalk Multi-container databases and persistent storage 使用 ECS-CLI 将多容器 Docker 应用程序部署到 AWS ECS Fargate - Deploying multi-container docker application to AWS ECS Fargate using ECS-CLI 将Perl Docker容器部署到Elastic Beanstalk - Deploying Perl Docker Container to Elastic Beanstalk 将Docker容器部署到Elastic Beanstalk时出错 - Error Deploying Docker Container to Elastic Beanstalk
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM