Pergunta

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!

Foi útil?

Solução

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!!

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top