启动脚本中的Elastic Beanstalk失败

我正在尝试将一个Node.js应用程序部署到弹性beanstalk。 问题是,每次启动脚本都会失败。 我将ec2configuration为使用启动脚本npm start ,它执行node app.js (在package.json中定义)。 但是,这个启动脚本在ec2中失败。 我得到logging的错误,

 npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the myProject start script 'node app.js'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the Portfolio package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node app.js npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs myProject npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls myProject npm ERR! There is likely additional logging output above. 

这是什么意思? 在我的命令行上运行npm start在同一个压缩到AWS的应用程序的根目录下工作正常,在本地主机上运行。 我也更新了npm和node.js

这里是压缩部署的文件结构:

。压缩

  • node_modules /
  • 上市/
  • app.js
  • 的package.json
  • 包lock.json

我遇到了Elastic Beanstalk上类似症状的问题,这是由缺lessnpm依赖性引起的。 一些依赖项本地安装在node_modules中,但是我们全局安装了一两个依赖项,导致它们在进行部署压缩时不能打包。 不幸的是Elastic Beanstalk的错误信息在这种情况下不是有用的,并且给出了一个通用的错误。