node.jsamazon-ec2forever

Forever: command not found


I am getting a

forever: command not found error when I run a nodejs process using the forever command as a cronjob (in an amazon ec2 machine): the bash script I am using has the following code:

cd to/location/of/the/nodejs/file

forever start file.js

but I am able to run this file by using bash script.sh but I get the forever:command not found error when I run it via cronjob

I am confused dont know what could be the reason for this.

Has anybody else faced this problem?

Thanks in advance


Solution

  • Run this command: npm install forever -g

    -g is to install it globally.