nodejs forever : How to run my npm application

前端 未结 3 544
天涯浪人
天涯浪人 2021-02-07 11:34

Right now i am runnign my nodejs application as npm start. i want to run it in background. I found forever package for this but dont know how can i run

3条回答
  •  我寻月下人不归
    2021-02-07 11:50

    For Linux Use terminal and enter in superuser mode, and try these code

    $ nohup node  &
    $ exit
    

    Note: This '&' is must before you press enter

    or for npm command, just goto the location by cd command where your package.json is stored. Then

    $ nohup npm start &
    $ exit
    

    Note: This '&' is must before you press enter

    To stop it

    $ top
    

    You can see process id here, then use following code

    $ kill -9 
    

提交回复
热议问题