我有一个简单的应用,其中包含一个nginx
反向代理后面的几个容器。应用程序是用JavaScript编写的,我在前端和后端以及其他模块中都使用了webpack
。 。 Webpack
中列出了devDependencies
。我试图在elasticbeanstalk
上运行的Docker
环境中在AWS 64bit Amazon Linux 2/3.2.0
上部署此应用程序(这对我来说是全新的),并且我遇到此错误:
...
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
在生产模式下运行npm install
,因此使用某些配置,我应该能够使elasticbeanstalk
安装devDependencies
并使用webpack
。我搜索了文档并在这里和那里阅读了帖子。我试图:
NPM_USE_PRODUCTION
设置为false,./ebextensions/something.config
:option_settings:
- namespace: aws:elasticbeanstalk:environment
option_name: NPM_USE_PRODUCTION
value: false
./ebextensions/something.config
here。我想这是正确的方法,但是会导致部署失败并显示以下错误: 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)
没有运气。我想念什么?
答案 0 :(得分:0)
好吧,我想念的是 AWS(在我挣扎的时候)不关心您的节点项目的开发依赖项,所以我的应用程序不适合。