Hey guys I am back with another blog post. In this post we will be discussing How to exit in Node.js?. We will be discussing the different sort of commands that we can use to exit out of node.js application i.e. to terminate the node.js process. Let’s start by seeing the different methods which are as follows:


Call the global process object’s exit method:


From the docs you can provide certain code in exit method:


If you are in a Unix Terminal or windows command line and want to exit the node:

  • Press Ctrl + C twice, or
  • type .exit and press Enter, or
  • press Ctrl + D at the start of a line (Unix only)


From the command line in Unix or Windows .exit is what you want::


1 – Catchall for general errors
2 – Misuse of shell builtins (according to Bash documentation)
126 – Command invoked cannot execute
127 – “command not found”
128 – Invalid argument to exit
128+n – Fatal error signal “n”
130 – Script terminated by Control-C
255\* – Exit status out of range

This is the end of the post and you have successfully understood how to exit in Node.js. Thank you very much for reading this post and also please subscribe to our newsletter for receiving more posts like this.

A programmer scientist by the mind and a passionate blogger by heart ❤️. Fountainhead of Coding Shiksha Life motto: Live while you can! Teach & inspire while you could & Smile while you have the teeth.

Gautam Sharma

Founder , Coding Shiksha


Submit a Comment

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