Categories
JavaScript Answers

How to run Node.js app forever when console is closed?

Spread the love

To run Node.js app forever when console is closed, we use the forever package.

For instance, we run

sudo npm install -g forever

to install forever globally.

Then we run server.js even when the console is closed with

forever start server.js

And we stop it with

forever stop server.js

We see the list of running processes with

forever list

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *