How do I run a node.js app as a background service?

前端 未结 26 1094
隐瞒了意图╮
隐瞒了意图╮ 2020-11-22 05:28

Since this post has gotten a lot of attention over the years, I\'ve listed the top solutions per platform at the bottom of this post.


Original post

26条回答
  •  误落风尘
    2020-11-22 06:03

    Try to run this command if you are using nohup -

    nohup npm start 2>/dev/null 1>/dev/null&
    

    You can also use forever to start server

    forever start -c "npm start" ./ 
    

    PM2 also supports npm start

    pm2 start npm -- start
    

提交回复
热议问题