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

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap