node.js - Elastic Beanstalk 出现 Node.js 启动错误

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

我在尝试在 elastic beanstalk 中运行 node.js 应用程序时遇到错误。我按照说明here进行操作对于 Express 应用程序,但是当我检查 Node.js 日志时,我可以看到 Node 进程因权限错误而退出。我不知道在这里做什么?

> express-test@0.0.1-52 start /var/app/current
> src/server.js

sh: src/server.js: Permission denied

npm ERR! express-test@0.0.1-52 start: `src/server.js`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the express-test@0.0.1-52 start script.
npm ERR! This is most likely a problem with the express-test package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     src/server.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls express-test
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.10.35-43.137.amzn1.x86_64
npm ERR! command "/opt/elasticbeanstalk/node-install/node-v0.10.26-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v0.10.26-linux-x64/bin/npm" "start"
npm ERR! cwd /var/app/current
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.4
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /var/app/current/npm-debug.log
npm ERR! not ok code 0

最佳答案

您的 package.json 文件的 scripts 部分有什么内容?

我猜你忘了输入命令的开头部分,而是尝试执行 server.js,这是一个 js 文件,不可执行。

相反,请尝试:

"scripts": {
    "start": "node server.js"
  },

关于node.js - Elastic Beanstalk 出现 Node.js 启动错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26071084/

相关文章:

json - Crystal : slow json serialization of structs containing large strings

javascript - 如何使用Mongoose使用MongoDB事务?

amazon-web-services - 如何查找 EC2 自动扩展组 "health check"失败的原因? (不涉及负载均衡器)

amazon-web-services - AWS EB .ebextensions - 包含无效 key

python - 在部署时动态更改 dockerrun.aws.json 图像标签

angularjs - 运行 npm install -g yo 命令给出 ->"npm ERR! Windows_NT 6.1.7601"

node.js - Mongoose $maxDistance 不精确

amazon-web-services - AWS 元数据端点在 CodeBuild 中不可用

node.js - 如何在 Lambda 中使用 putParameter 和 aws-sdk for nodejs 获取过去的错误?

mysql - elastic beanstalk docker app无法连接到mysql