Home > Article > Web Front-end > Node.js deployment starts background running forever step-by-step explanation
Today I will share with you an articlenode.jsHow to deploy and start running forever in the background. It has a good reference value and I hope it will be helpful to everyone. Let’s follow the editor and 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 execute
npm install
or
node index.js
Or use bat file to execute
The method is to first create a txt file, 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, after starting like this, 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 directory
cd 你的项目路径
2. Theninstall
npm install forever -g
3.Start
forever start app.js
4.Close
forever stop app.js #关闭
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the PHP Chinese website!
Recommended reading:
Detailed explanation of the steps to use JS string method
Use the front-end method to convert images to character paintings
The above is the detailed content of Node.js deployment starts background running forever step-by-step explanation. For more information, please follow other related articles on the PHP Chinese website!