当我尝试在AWS Elastic Beanstalk中安装与Google相关的npm模块时,它会失败并且环境会降级。其他软件包,例如express或socket io都可以正常工作。关于如何在AWS上安装google npm模块的任何想法吗?我试图将模块的版本写在package.json文件中,并将其与app.js一起压缩,文件不是节点模块
{
"name": "dialogflow-aws",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"dialogflow": "^0.5.0",
"express": "^4.16.3"
}
}
,然后单击在AWS ELB控制台上上传和部署。变成红色。日志如下:-
Running npm with --production flag
Failed to run npm install. Snapshot logs for more details.
Traceback (most recent call last):
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 695, in <module>
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-v6.14.3-linux-x64/bin/npm', '--production', 'install']' returned non-zero exit status 1 (Executor::NonZeroExitStatus)
更多日志:
39674 silly lifecycle 'node-pre-gyp install --fallback-to-build --library=static_library' ]
39675 verbose stack Error: spawn ENOMEM
39675 verbose stack at exports._errnoException (util.js:1020:11)
39675 verbose stack at ChildProcess.spawn (internal/child_process.js:328:11)
39675 verbose stack at exports.spawn (child_process.js:370:9)
39675 verbose stack at spawn (/opt/elasticbeanstalk/node-install/node-v6.14.3-linux-x64/lib/node_modules/npm/lib/utils/spawn.js:21:13)
39675 verbose stack at runCmd_ (/opt/elasticbeanstalk/node-install/node-v6.14.3-linux-x64/lib/node_modules/npm/lib/utils/lifecycle.js:247:14)
39675 verbose stack at /opt/elasticbeanstalk/node-install/node-v6.14.3-linux-x64/lib/node_modules/npm/lib/utils/lifecycle.js:211:7
39675 verbose stack at _combinedTickCallback (internal/process/next_tick.js:73:7)
39675 verbose stack at process._tickCallback (internal/process/next_tick.js:104:9)
39676 verbose cwd /tmp/deployment/application
39677 error Linux 4.14.47-56.37.amzn1.x86_64
39678 error argv "/opt/elasticbeanstalk/node-install/node-v6.14.3-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v6.14.3-linux-x64/bin/npm" "--production" "install"
39679 error node v6.14.3
39680 error npm v3.10.10
39681 error code ENOMEM
39682 error errno ENOMEM
39683 error syscall spawn
39684 error spawn ENOMEM
39685 error If you need help, you may report this error at:
39685 error <https://github.com/npm/npm/issues>
39686 verbose exit [ 1, true ]