zapty / forever-service

Provision node script as a service via forever, allowing it to automatically start on boot, working across various Linux distros and OS
https://github.com/zapty/forever-service
MIT License
594 stars 65 forks source link

/usr/bin/env: node no such file on Amazon Linux #50

Open ryanjarvis opened 8 years ago

ryanjarvis commented 8 years ago

Amazon Linux AMI release 2015.09

sudo forever-service install -s server.js --start test

returns saying the service was provisioned successfully but then I get

Starting machinetest
/usr/bin/env: node: No such file or directory
Service could not be started

node is installed at /usr/local/bin And /usr/local/bin appears to be on the $PATH for both the user, sudoers and root.

Also just calling forever server.js appears to work

Any ideas?

ryanjarvis commented 8 years ago

I stand corrected. /usr/local/bin was not in root's PATH. I only thought it was because I had set the paths available for sudoers earlier using sudo visudo.

Since /usr/local/bin is not part of the path for a default Amazon Linux image, the workaround was to set an environment variable when calling forever-service install -e "PATH=/usr/local/bin:$PATH"

jaymehtasa commented 7 years ago

this worked with Amazon AMI.

Thanks a lot.

vieko commented 7 years ago

Awesome, this solved it for me under latest Amazon AMI.

joneldiablo commented 3 years ago

still not working forme I'm using nvm I trying this:

sudo "$(which forever-service)" install validex-cron -f " --watchDirectory ./src -w -o out.log -e err.log -c /home/ubuntu/.nvm/versions/node/v14.16.1/bin/node " -e "PATH=/home/ubuntu/.nvm/versions/node/v14.16.1/bin:$PATH" --script ./src/index.js

but not working

joneldiablo commented 3 years ago

this can install the service but can't run the process =,(

sudo env "PATH=$PATH" forever-service install validex-cron -f " --watchDirectory ./src -w -o out.log -e err.log -c /home/ubuntu/.nvm/versions/node/v14.16.1/bin/node" --script ./src/index.js