【问题标题】:Elastic Beanstalk - 502 error when accesing the webapplication, package.json not foundElastic Beanstalk - 访问 Web 应用程序时出现 502 错误,找不到 package.json
【发布时间】:2018-06-18 21:18:59
【问题描述】:

我刚刚将我的第一个 Web 应用程序部署到 Elastic Beanstalk,但是当我尝试访问它时,我收到“502 Bad Gateway”错误。在日志中,我看到了这个错误。

npm ERR! Please include the following file with any support request:
npm ERR!     /var/app/current/npm-debug.log
npm ERR! Linux 4.14.33-51.37.amzn1.x86_64
npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v6.13.1-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v6.13.1-linux-x64/bin/npm" "start"
npm ERR! node v6.13.1
npm ERR! npm  v3.10.10
npm ERR! path /var/app/current/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open '/var/app/current/package.json'
npm ERR! enoent ENOENT: no such file or directory, open '/var/app/current/package.json'
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 

我做了一些谷歌搜索,似乎这个问题发生在用户不仅压缩文件夹的内容,而且压缩顶级文件夹本身时。但是,这不是我的情况 - 我的 .zip 文件的根目录中有 package.json 文件,但系统仍然找不到它。有谁知道问题出在哪里或如何找到根本原因?

谢谢

【问题讨论】:

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


    【解决方案1】:

    好的,刚刚找到问题的核心——node.js不是EB自动启动的。要修复它,我必须在压缩文件的根目录中创建文件夹“.ebextensions”,并在其中创建一个包含以下内容的文件 nodecommand.config

    option_settings:
      - namespace: aws:elasticbeanstalk:container:nodejs
        option_name: NodeCommand
        value: "npm start"
    

    【讨论】:

      猜你喜欢
      • 2018-09-18
      • 2019-06-21
      • 2019-09-25
      • 2022-01-12
      • 2019-07-27
      • 2021-10-02
      • 2018-10-12
      • 2016-05-25
      • 1970-01-01
      相关资源
      最近更新 更多