How to Exit Node Prompt from Mac Terminal

If you are inside the node prompt on your Mac Terminal and want to exit it, you can simply press Control + C or Control + D to exit and return to the shell prompt.

Note: Exit and Quite commands do not work with node and you will get an Uncaught ReferenceError error.

Macbook % node

Welcome to Node.js v20.6.1.
Type ".help" for more information.

> exit
Uncaught ReferenceError: exit is not defined
> quit
Uncaught ReferenceError: quit is not defined
> 

Example to Quit Node on Mac Terminal

% node
Welcome to Node.js v20.6.1.
Type ".help" for more information.
> 
zsh: suspended  node
Macbook % node
Welcome to Node.js v20.6.1.
Type ".help" for more information.
> 
(To exit, press Ctrl+C again or Ctrl+D or type .exit)
> 
How to Exit Node Prompt on Mac Terminal

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!