我正在尝试将Node.js应用部署到EB。问题是,我在我的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).
在这一切中,我发现Failed to run npm install. Snapshot logs for more details.
为什么会发生这种情况?我的应用程序在本地运行得非常好 - 为什么它不能在aws上运行?
文件结构: 的.zip