문제

I am trying to get my Node app running reliably from an amazon ec2 instance. I have tried:

  1. to install forever I get a ton of errors:

    npm ERR! Error: ENOENT, ... 50 lines of errors ... npm ERR! fstream_stack Object.oncomplete (fs.js:96:15)

  2. nohup node server.js &

Method 2 works but it doesn't start my app again if it goes down. Can someone show me how to use nohup to also restart the app if it goes down? Thanks!

도움이 되었습니까?

해결책

maybe you can try with supervisor:

https://github.com/isaacs/node-supervisor

Quite simple, if something goes wrong it just restart.

For a more complex control, including server restart you can try pm2

https://github.com/Unitech/pm2

pm2 is amazing!!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top