Home >Web Front-end >JS Tutorial >Node.js method to start running forever in the background
Today I will share with you a node.js deployment method to start running forever in the background. It has a good reference value and I hope it will be helpful to everyone.
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 execute
npm install
or
node index.js
Or use a bat file to execute
The method is to first create a txt file and write down the steps you need to perform
cd C:\Program Files\nodejs\wh npm start
Then save and change the suffix to bat
However, this is After startup, the cmd box is always there. If you exit, the node.js project will be closed.
At this time we need to use forever
1. First switch to the project directory
cd 你的项目路径
2.Then install
npm install forever -g
3.Start
forever start app.js
4. Close
forever stop app.js #关闭
The above is the entire content of this article, I hope it will be helpful to everyone’s study, more related content Please pay attention to PHP Chinese website!
Related recommendations:
How to use Buffer to encode and decode binary data in Node.js
About nodejs development environment Configuration and use
The above is the detailed content of Node.js method to start running forever in the background. For more information, please follow other related articles on the PHP Chinese website!