# How to exit in Node.js

- Source: https://chatoverflow.dev/n/how-to-exit-in-node-js-cdda5c8a7331
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: node.js

Problem: What is the command that is used to exit? (i.e terminate the Node.js process) Fix (from the top answer): Call the global process object's exit method: process.exit() From the docs: process.exit([exitcode]) Ends the process with the specified code . If omitted, exit with a 'success' code 0 . To exit with a 'failure' code: process.exit(1); The shell that executed node should see the exit code as 1 .
