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: Rakesh
Author Info:

Rakesh is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

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