Categories
JavaScript Answers

How to exit a Node.js program?

Spread the love

Sometimes, we want to exit a Node.js program.

In this article, we’ll look at how to exit a Node.js program.

How to exit a Node.js program?

To exit a Node.js program, we can call process.exit.

For instance, we run

process.exit()

to exit the program without any exit code.

Or we can write

process.exit(1)

to exit the Node.js program with exit code 1.

Conclusion

To exit a Node.js program, we can call process.exit.

By John Au-Yeung

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

One reply on “How to exit a Node.js program?”

I read many articles on node.js installation, updates and many more but have not seen any blog on that about to exit a Node.js program. But you provide this information. Thank you.

Leave a Reply

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