Node.js Exit Codes Last Updated : 28 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report Node.js is a cross-platform, open-source back-end JavaScript runtime environment that uses the V8 engine to execute JavaScript code outside of a web browser. Node.js allows developers to utilize JavaScript to create command-line tools and server-side scripting, which involves running scripts on the server before sending the page to the user's browser. In the following article, we are going to talk about the different exit codes in node.js when exiting a process. The following is the list of exit codes in Node.js along with its descriptions: Exit Code 0: Node.js normally ends with a status code of 0 whenever there are no more open async operations and the code doesn't produce any uncaught exceptions.Exit Code 1, Uncaught Fatal Exception: If an uncaught exception occurs and it is not resolved by a domain or a "uncaughtException" event handler, Node.js exits with an exit code of 1.Exit Code 2: The exit code 2 is reserved by Bash for abuse of built-in features.Exit Code 3, Internal JavaScript Parse Error: When internal code cannot be effectively interpreted, this exit code might be utilised in development. This is highly uncommon and often only occurs while Node.js is being developed.Exit Code 4, Internal JavaScript Evaluation Failure: It is also applied in situations where the JavaScript code fails to return the function value during development.Exit Code 5, Fatal Error: When a fatal, unrecoverable error occurred in V8, this exit code is utilised. Usually, stderr will produce a message with the prefix FATAL ERROR.Exit Code 6, Non-function Internal Exception Handler: When an internal fatal exception handler function is set to a non-function and unable to be invoked, it is helpful.Exit Code 7, Internal Exception Handler Run-Time Failure: This error code is used when the internal fatal exception handler code itself issued an error when attempting to handle the uncaught exception. This may occur, for instance, if a domain.on('error') handler or a "uncaughtException" returns an error.Exit Code 8: Exit code 8 in earlier versions of Node.js was sometimes used to denote an uncaught error.Exit Code 9, Invalid Argument: This is employed when an unspecified option was given or when a value-required option was given without one..Exit Code 10, Internal JavaScript Run-Time Failure: When the bootstrapping function was invoked, the JavaScript source code internal to Node.js's bootstrapping procedure threw an error.Exit Code 12, Invalid Debug Argument: The ports specified were either unavailable or invalid, yet the —debug, —inspect, and/or —debug-brk options were set.Exit Code >128, Signal Exits: Node.js's exit code is 128 plus the signal code's value if it gets a fatal signal like SIGKILL or SIGHUP. This is a common Unix practice since signal exits set the high-order bit before containing the signal code's value and exit codes are often specified as 7-bit integers. Example 1: The code in the following example terminates without any error, hence an exit code of 0. JavaScript console.log("Running..."); process.on('exit', function(code){ return console.log(`Exiting with code ${code}`); }); Output:  Example 2: In this example, we will deliberately terminate the following code with exit code 1. JavaScript console.log('This code will terminate with exit code 1'); process.on('exit', function(code) { return console.log(`Exit Code: ${code}`); }); setTimeout((function() { return process.exit(1); }), 5000); Output:  Reference: https://nodejs.org/api/process.html#process_exit_codes Comment More infoAdvertise with us A aayushmohansinha Follow Improve Article Tags : Web Technologies Node.js Node.js-process-module Similar Reads Non-linear Components In electrical circuits, Non-linear Components are electronic devices that need an external power source to operate actively. Non-Linear Components are those that are changed with respect to the voltage and current. Elements that do not follow ohm's law are called Non-linear Components. Non-linear Co 11 min read JavaScript Tutorial JavaScript is a programming language used to create dynamic content for websites. It is a lightweight, cross-platform, and single-threaded programming language. It's an interpreted language that executes code line by line, providing more flexibility.JavaScript on Client Side: On the client side, Jav 11 min read Web Development Web development is the process of creating, building, and maintaining websites and web applications. It involves everything from web design to programming and database management. Web development is generally divided into three core areas: Frontend Development, Backend Development, and Full Stack De 5 min read Spring Boot Tutorial Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance 10 min read React Interview Questions and Answers React is an efficient, flexible, and open-source JavaScript library that allows developers to create simple, fast, and scalable web applications. Jordan Walke, a software engineer who was working for Facebook, created React. Developers with a JavaScript background can easily develop web applications 15+ min read React Tutorial React is a powerful JavaScript library for building fast, scalable front-end applications. Created by Facebook, it's known for its component-based structure, single-page applications (SPAs), and virtual DOM,enabling efficient UI updates and a seamless user experience.Note: The latest stable version 7 min read JavaScript Interview Questions and Answers JavaScript is the most used programming language for developing websites, web servers, mobile applications, and many other platforms. In Both Front-end and Back-end Interviews, JavaScript was asked, and its difficulty depends upon the on your profile and company. Here, we compiled 70+ JS Interview q 15+ min read Class Diagram | Unified Modeling Language (UML) A UML class diagram is a visual tool that represents the structure of a system by showing its classes, attributes, methods, and the relationships between them. It helps everyone involved in a projectâlike developers and designersâunderstand how the system is organized and how its components interact 12 min read Backpropagation in Neural Network Back Propagation is also known as "Backward Propagation of Errors" is a method used to train neural network . Its goal is to reduce the difference between the modelâs predicted output and the actual output by adjusting the weights and biases in the network.It works iteratively to adjust weights and 9 min read 3-Phase Inverter An inverter is a fundamental electrical device designed primarily for the conversion of direct current into alternating current . This versatile device , also known as a variable frequency drive , plays a vital role in a wide range of applications , including variable frequency drives and high power 13 min read Like