Home > Article > Web Front-end > How to use node.js to start running in the background forever
This time I will show you how to use node.js to start running forever in the background and use node.js to start running forever in the background. What are the precautions? The following is a practical case. Let’s take a look.
We know that if you want to run the project after deployment, you need to use the command line cd to the project directory and then executenpm install
or
node index.jsOr use a bat file to executeThe method is to first create a txt file and write down the steps you need to perform
cd C:\Program Files\nodejs\wh npm startThen save and change the suffix to batHowever, this is After startup, the cmd box is always there. If
exit, the node.js project will be closed.
At this time we need to use forever##1 .First switch to the project directorycd 你的项目路径
2.ThenInstall##npm install forever -g
forever start app.js
forever stop app.js #关闭
I believe you have mastered it after reading the case in this article For more exciting methods, please pay attention to other related articles on the php Chinese website!
vue Nested Routing and 404 Redirect Implementation Method Analysis_vue.js
How to use Internationalization of your own js code
The above is the detailed content of How to use node.js to start running in the background forever. For more information, please follow other related articles on the PHP Chinese website!