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 %

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 %
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!