Amazon web services “npm安装”在elastic beanstalk上失败,但可以手动执行
我已经检查过了,这似乎不是我的问题。 我正在弹性beanstalk上部署一个django代码,它使用react。为了编译react文件,我运行了npm安装和npm运行构建,这似乎失败了。这些在.ebextensions配置文件中指定 但是,如果我使用ssh连接到实例中并设置环境并手动运行npm安装,那么它可以正常工作 我不知道发生了什么事 下面是npm-debug.log的尾部 .ebextension/01_packages.config以安装节点Amazon web services “npm安装”在elastic beanstalk上失败,但可以手动执行,amazon-web-services,npm,amazon-elastic-beanstalk,Amazon Web Services,Npm,Amazon Elastic Beanstalk,我已经检查过了,这似乎不是我的问题。 我正在弹性beanstalk上部署一个django代码,它使用react。为了编译react文件,我运行了npm安装和npm运行构建,这似乎失败了。这些在.ebextensions配置文件中指定 但是,如果我使用ssh连接到实例中并设置环境并手动运行npm安装,那么它可以正常工作 我不知道发生了什么事 下面是npm-debug.log的尾部 .ebextension/01_packages.config以安装节点 packages: yum: g
packages:
yum:
git: []
postgresql93-devel: []
libjpeg-turbo-devel: []
commands:
01_node_install:
cwd: /tmp
test: '[ ! -f /usr/bin/npm ] && echo "npm not installed"'
command: 'curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - && yum -y install nodejs'
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/00_set_tmp_permissions.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
chown -R nodejs:nodejs /tmp/.npm
.ebextensions/02_python.config用于运行npm安装
添加更多详细信息:
npm版本为3.10.10,节点版本为6.11.3,npm注册表为,体系结构为Linux。解决了这个问题。在部署到t2.micro实例时,似乎经常发生ENOMEM错误。它发生在ec2实例上的部署内存不足时。 通过添加交换空间修复了此问题。查看此项了解更多详细信息
[2017-09-08T06:18:43.012Z] ERROR [7803] : Command execution failed: Activity failed. (ElasticBeanstalk::ActivityFatalError)
caused by: npm WARN prefer global node-gyp@3.6.2 should be installed with -g
> node-sass@4.5.3 install /opt/python/bundle/3/app/eb_miral/node_modules/node-sass
> node scripts/install.js
(ElasticBeanstalk::ExternalInvocationError)
[2017-09-08T06:18:43.012Z] ERROR [7803] : Command CMD-AppDeploy failed!
[2017-09-08T06:18:43.029Z] INFO [7803] : Command processor returning results:
{"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"npm WARN prefer global node-gyp@3.6.2 should be installed with -g\n\n> node-sass@4.5.3 install /opt/python/bundle/3/app/eb_miral/node_modules/node-sass\n> node scripts/install.js. \ncontainer_command 03_npm_build in .ebextensions/02_python.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI","returncode":1,"events":[]}]}
packages:
yum:
git: []
postgresql93-devel: []
libjpeg-turbo-devel: []
commands:
01_node_install:
cwd: /tmp
test: '[ ! -f /usr/bin/npm ] && echo "npm not installed"'
command: 'curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - && yum -y install nodejs'
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/00_set_tmp_permissions.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
chown -R nodejs:nodejs /tmp/.npm
container_commands:
01_migrate:
command: "source /opt/python/run/venv/bin/activate && python eb_miral/manage.py migrate --settings=miral.settings.production --noinput"
leader_only: true
02_createsu:
command: "source /opt/python/run/venv/bin/activate && python eb_miral/manage.py createsu --settings=miral.settings.production"
leader_only: true
# You can define a build script in packages.json (using gulp, grunt...) to build your client side files
03_npm_build:
command: 'npm install --prefix ./eb_miral/ && npm --prefix ./eb_miral/ run build'
04_collectstatic:
command: "source /opt/python/run/venv/bin/activate && python eb_miral/manage.py collectstatic --noinput --settings=miral.settings.production"
leader_only: true # Because it should push everything to cloud only once