Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

On a free-tier Amazon EC2 instance, I set up a simple node.js Hello World app running on express.

If I run npm start, my app runs fine and I can hit it from my browser, and I see the following output:

> [email protected] start /home/ec2-user/app

> node ./bin/www

I have installed the forever tool globally. When I run forever start app.js, I see:

warn:    --minUptime not set. Defaulting to: 1000ms

warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms

info:    Forever processing file: app/app.js

However, when I check forever list, I see that the process has stopped:

info:    Forever processes running

data:        uid command             script forever pid id logfile                          uptime  

data:    [0] 2v0J /usr/local/bin/node app.js 2455    2457 /home/ec2-user/.forever/2v0J.log STOPPED 

This is the only message in the log: error: Forever detected script was killed by signal: null

I'm unable to find any other log information. Why does it keep immediately stopping?

I tried running it as nohup forever start app.js and got the same problem. I'm running the forever start and the forever list in the same ssh session, one after the other. The app's process seems to stop immediately.

1 Answer

0 votes
by (44.4k points)

If the process is stopped after disconnecting from ssh, then try running nohup first.

nohup forever start app.js

Or you can use forever start ./bin/www instead of passing the application app.js

Related questions

0 votes
1 answer
asked Jul 8, 2019 in AWS by yuvraj (19.1k points)
Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...