worker1138 worker1138 - 10 months ago 72
Node.js Question

Elastic Beanstalk with node.js start error

I'm getting an error when trying to run a node.js app in elastic beanstalk. I followed the instructions here for an express app, but when I inspect the node.js logs, I can see the node process exits with a permissions error. I'm not sure what to do here?

> 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!
npm ERR! Additional logging details can be found in:
npm ERR! /var/app/current/npm-debug.log
npm ERR! not ok code 0


What do you have in your package.json file in the scripts section?

I'm guessing you forgot to put the beginning part of the command and instead it is trying to execute server.js, which is a js file and isn't executable.

Instead, try:

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