Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Elastic Beanstalk-502访问Web应用程序时出错,找不到package.json_Node.js_Amazon Web Services_Amazon Elastic Beanstalk - Fatal编程技术网

Node.js Elastic Beanstalk-502访问Web应用程序时出错,找不到package.json

Node.js Elastic Beanstalk-502访问Web应用程序时出错,找不到package.json,node.js,amazon-web-services,amazon-elastic-beanstalk,Node.js,Amazon Web Services,Amazon Elastic Beanstalk,我刚刚将我的第一个web应用程序部署到Elastic Beanstalk,但当我尝试访问它时,出现了“502坏网关”错误。在日志中,我看到了这个错误 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/

我刚刚将我的第一个web应用程序部署到Elastic Beanstalk,但当我尝试访问它时,出现了“502坏网关”错误。在日志中,我看到了这个错误

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不是由EB自动启动的。为了修复它,我必须在压缩文件的根目录中创建文件夹“.ebextensions”,并在其中创建一个包含以下内容的文件nodecommand.config

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