Fix: Uncaught ReferenceError: exit is not defined - Node.js REPL



If you are trying to exit the Node.js REPL (Read-Eval-Print Loop) environment by typing exit, you will get the below error.

Code2care@Mac % node
Welcome to Node.js v20.4.0.
Type ".help" for more information.
> 
> exit
Uncaught ReferenceError: exit is not defined

The command command to exit Node REPL is .exit

> .exit

Code2care@Mac % 
Fix - Uncaught ReferenceError- exit is not defined

If you are on a Mac, you can also press Control + Z to suspended node and comeback to your Terminal prompt.

> 
zsh: suspended  node
Code2care@Mac % 
-

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


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