How to exit from the Node.js command line#

So you loaded the Node REPL console by typing node at the command line, played around with it and want to get back to your OS command line.

Press CTRL+c (even on a Mac, especially on a Mac!), or just call the process.exit() method to exit from the Node console.

$ node
> 9+23
32
> process.exit()
$

or even simpler you can just type .exit.

$ node
> 1+2
3
> .exit
$

and even simpler type ctrlc, twice.

There you go!

References#

  1. Node.js - REPL
Tweet this | Share on LinkedIn |