Node.js AWS EB部署问题“;无法运行npm安装";

Node.js AWS EB部署问题“;无法运行npm安装";,node.js,amazon-web-services,amazon-ec2,amazon-elastic-beanstalk,Node.js,Amazon Web Services,Amazon Ec2,Amazon Elastic Beanstalk,我正在尝试将Node.js应用程序部署到EB。问题是,我的电子商务仪表板上出现错误,“更新环境操作已完成,但有错误”,而我的应用程序未运行 因此,我获取了实例的错误日志: i-0d5cffacd74ddf4dc Severe 5 hours 2 - - - - - - - - - - 0.00 0.00 0.0 0.0 100 0.0 Application deployment failed at 2017-11-26T

我正在尝试将Node.js应用程序部署到EB。问题是,我的电子商务仪表板上出现错误,“更新环境操作已完成,但有错误”,而我的应用程序未运行

因此,我获取了实例的错误日志:

        i-0d5cffacd74ddf4dc Severe  5 hours 2   -   -   -   -   -   -   -   -   -   -   0.00    0.00    0.0 0.0 100 0.0
Application deployment failed at 2017-11-26T17:43:27Z with exit status 1 and error: Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh failed.

+ /opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install
npm WARN lifecycle node@9.2.0~preinstall: cannot run in wd %s %s (wd=%s) node@9.2.0 node installArchSpecificPackage /tmp/deployment/application/node_modules/.staging/node-2356d873
Portfolio@0.0.1 /tmp/deployment/application
├─┬ body-parser@1.18.2 
│ ├── bytes@3.0.0 
│ ├── content-type@1.0.4 
│ ├─┬ debug@2.6.9 
│ │ └── ms@2.0.0 
│ ├── depd@1.1.1 
│ ├─┬ http-errors@1.6.2 
│ │ ├── inherits@2.0.3 
│ │ ├── setprototypeof@1.0.3 
│ │ └── statuses@1.4.0 
│ ├── iconv-lite@0.4.19 
│ ├─┬ on-finished@2.3.0 
│ │ └── ee-first@1.1.1 
│ ├── qs@6.5.1 
│ ├─┬ raw-body@2.3.2 
│ │ └── unpipe@1.0.0 
│ └─┬ type-is@1.6.15 
│ ├── media-typer@0.3.0 
│ └─┬ mime-types@2.1.17 
│ └── mime-db@1.30.0 
├─┬ express@4.16.2 
│ ├─┬ accepts@1.3.4 
│ │ └── negotiator@0.6.1 
│ ├── array-flatten@1.1.1 
│ ├── content-disposition@0.5.2 
│ ├── cookie@0.3.1 
│ ├── cookie-signature@1.0.6 
│ ├── encodeurl@1.0.1 
│ ├── escape-html@1.0.3 
│ ├── etag@1.8.1 
│ ├─┬ finalhandler@1.1.0 
│ │ └── statuses@1.3.1 
│ ├── fresh@0.5.2 
│ ├── merge-descriptors@1.0.1 
│ ├── methods@1.1.2 
│ ├── parseurl@1.3.2 
│ ├── path-to-regexp@0.1.7 
│ ├─┬ proxy-addr@2.0.2 
│ │ ├── forwarded@0.1.2 
│ │ └── ipaddr.js@1.5.2 
│ ├── range-parser@1.2.0 
│ ├── safe-buffer@5.1.1 
│ ├─┬ send@0.16.1 
│ │ ├── destroy@1.0.4 
│ │ ├── mime@1.4.1 
│ │ └── statuses@1.3.1 
│ ├── serve-static@1.13.1 
│ ├── setprototypeof@1.1.0 
│ ├── statuses@1.3.1 
│ ├── utils-merge@1.0.1 
│ └── vary@1.1.2 
└── nodemailer@4.4.0 

npm ERR! Linux 4.9.58-18.55.amzn1.x86_64
npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v6.11.5-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v6.11.5-linux-x64/bin/npm" "--production" "install"
npm ERR! node v6.11.5
npm ERR! npm v3.10.10
npm ERR! path /tmp/deployment/application/node_modules/node/bin/node
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod

npm ERR! enoent ENOENT: no such file or directory, chmod '/tmp/deployment/application/node_modules/node/bin/node'
npm ERR! enoent ENOENT: no such file or directory, chmod '/tmp/deployment/application/node_modules/node/bin/node'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR! /tmp/deployment/application/npm-debug.log
Running npm install: /opt/elasticbeanstalk/node-install/node-v6.11.5-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.
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.11.5-linux-x64/bin/npm', '--production', 'install']' returned non-zero exit status 254.
Incorrect application version "Deploy5" (deployment 2). Expected version "Deploy06" (deployment 3).
i-0D5CFACD74DDF4DC严重5小时2----0.00 0.00 0.0 100 0.0
2017-11-26T17:43:27Z应用程序部署失败,退出状态为1,错误:Hook/opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh失败。
+/opt/elasticbeanstalk/containerfiles/ebnode.py--操作npm安装
npm警告生命周期node@9.2.0~preinstall:无法在wd%s%s中运行(wd=%s)node@9.2.0节点installArchSpecificPackage/tmp/deployment/application/node_modules/.staging/node-2356d873
Portfolio@0.0.1/tmp/deployment/application
├─┬ 身体-parser@1.18.2 
│ ├── bytes@3.0.0 
│ ├── 内容-type@1.0.4 
│ ├─┬ debug@2.6.9 
│ │ └── ms@2.0.0 
│ ├── depd@1.1.1 
│ ├─┬ http-errors@1.6.2 
│ │ ├── inherits@2.0.3 
│ │ ├── setprototypeof@1.0.3 
│ │ └── statuses@1.4.0 
│ ├── iconv-lite@0.4.19 
│ ├─┬ 在-finished@2.3.0 
│ │ └── ee-first@1.1.1 
│ ├── qs@6.5.1 
│ ├─┬ 生的-body@2.3.2 
│ │ └── unpipe@1.0.0 
│ └─┬ 类型-is@1.6.15 
│ ├── 媒体-typer@0.3.0 
│ └─┬ 默剧-types@2.1.17 
│ └── 默剧-db@1.30.0 
├─┬ express@4.16.2 
│ ├─┬ accepts@1.3.4 
│ │ └── negotiator@0.6.1 
│ ├── 排列-flatten@1.1.1 
│ ├── 内容-disposition@0.5.2 
│ ├── cookie@0.3.1 
│ ├── 饼干-signature@1.0.6 
│ ├── encodeurl@1.0.1 
│ ├── 逃脱-html@1.0.3 
│ ├── etag@1.8.1 
│ ├─┬ finalhandler@1.1.0 
│ │ └── statuses@1.3.1 
│ ├── fresh@0.5.2 
│ ├── 合并-descriptors@1.0.1 
│ ├── methods@1.1.2 
│ ├── parseurl@1.3.2 
│ ├── 通往-regexp@0.1.7 
│ ├─┬ 代理-addr@2.0.2 
│ │ ├── forwarded@0.1.2 
│ │ └── ipaddr。js@1.5.2 
│ ├── 射程-parser@1.2.0 
│ ├── 安全的-buffer@5.1.1 
│ ├─┬ send@0.16.1 
│ │ ├── destroy@1.0.4 
│ │ ├── mime@1.4.1 
│ │ └── statuses@1.3.1 
│ ├── 服侍-static@1.13.1 
│ ├── setprototypeof@1.1.0 
│ ├── statuses@1.3.1 
│ ├── 乌提尔斯-merge@1.0.1 
│ └── vary@1.1.2 
└── nodemailer@4.4.0 
npm错误!Linux 4.9.58-18.55.amzn1.x86_64
npm错误!argv“/opt/elasticbeanstalk/node安装/node-v6.11.5-linux-x64/bin/node”“/opt/elasticbeanstalk/node安装/node-v6.11.5-linux-x64/bin/npm”“--生产“安装”
npm错误!节点v6.11.5
npm错误!npm v3.10.10
npm错误!路径/tmp/deployment/application/node_模块/node/bin/node
npm错误!代码eNONT
npm错误!errno-2
npm错误!系统调用chmod
npm错误!enoint enoint:没有这样的文件或目录,chmod'/tmp/deployment/application/node\u modules/node/bin/node'
npm错误!enoint enoint:没有这样的文件或目录,chmod'/tmp/deployment/application/node\u modules/node/bin/node'
npm错误!但这很可能不是npm本身的问题
npm错误!eNONT,与npm无法找到文件有关。
npm错误!埃诺特
npm错误!请在任何支持请求中包括以下文件:
npm错误/tmp/deployment/application/npm-debug.log
正在运行npm安装:/opt/elasticbeanstalk/node安装/node-v6.11.5-linux-x64/bin/npm
将npm配置作业设置为1
npm配置作业设置为1
使用--production标志运行npm
无法运行npm安装。有关更多详细信息,请参阅快照日志。
回溯(最近一次呼叫最后一次):
文件“/opt/elasticbeanstalk/containerfiles/ebnode.py”,第695行,中
main()
文件“/opt/elasticbeanstalk/containerfiles/ebnode.py”,第677行,主目录
节点\u版本\u管理器。运行\u npm\u安装(选项。应用程序\u路径)
文件“/opt/elasticbeanstalk/containerfiles/ebnode.py”,第136行,在run\u npm\u install中
self.npm\u安装(bin\u路径,self.config\u管理器.get\u容器\u配置('app\u staging\u dir'))
文件“/opt/elasticbeanstalk/containerfiles/ebnode.py”,第180行,在npm_安装中
提高e
subprocess.CalledProcessError:命令“[”/opt/elasticbeanstalk/node install/node-v6.11.5-linux-x64/bin/npm',“--production”,“install']”返回非零退出状态254。
不正确的应用程序版本“部署5”(部署2)。预期版本为“Deploy06”(部署3)。
在此过程中,我发现
无法运行npm安装。快照日志了解更多详细信息。
为什么会发生这种情况?我的应用程序在本地运行得非常好-为什么不能在aws上运行

文件结构: zip先生

  • 节点单元/
  • 公开的/
  • app.js
  • package.json

您确实需要在此处提供更多信息。看看你的日志,事情有点奇怪。它试图从tmp部署目录:/tmp/deployment/application/node\u modules/node/bin/node运行node,它说找不到。在基于节点的应用程序中,节点应该安装在服务器级别,您将使用该节点安装。我的应用程序非常基本。它是一个单页站点,具有通过NodeEmailer发送数据的表单。我用我的文件结构更新了我的问题,还有什么我可以提供的吗?