Elastic Beanstalk在启动脚本时失败

时间:2017-11-25 18:31:51

标签: json node.js amazon-web-services amazon-ec2 elastic-beanstalk

我试图将Node.js应用程序部署到弹性beanstalk。问题是,它每次都在启动脚本失败。我让ec2配置为使用启动脚本npm start,它执行node app.js(在package.json中定义)。但是,此启动脚本在ec2中失败。我收到了记录错误,

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的同一个应用程序的根目录中正常运行,在localhost上运行。我也更新了npm和node.js

以下是压缩部署的文件结构:

的.zip

  • node_modules /
  • 公共/
  • app.js
  • 的package.json
  • 包lock.json

1 个答案:

答案 0 :(得分:2)

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