Home > Web Front-end > JS Tutorial > Node.js deployment starts background running forever step-by-step explanation

Node.js deployment starts background running forever step-by-step explanation

php中世界最好的语言
Release: 2018-05-25 10:15:42
Original
2078 people have browsed it

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
Copy after login

or

node index.js
Copy after login

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
Copy after login

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 你的项目路径
Copy after login

2. Theninstall

npm install forever -g
Copy after login

3.Start

forever start app.js
Copy after login

4.Close

forever stop app.js #关闭
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template