node -e 'process.exit(1)'

Category: Node.js & npm/yarn

node -e 'process.exit(1)'

Exit Node immediately with a specific exit code — useful in shell scripts to signal failure

Exits Node immediately with exit code 1 (error). Shell scripts use exit codes to detect failures — 0 means success, anything else means failure.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.