nodeを終了する方法4選
① .exit
.exit と打つことで終了出来ます。
[name]MacBook-Pro:[filename] [name]$ node
Welcome to Node.js v13.5.0.
Type ".help" for more information.
> .exit
[name]MacBook-Pro:[filename] [name]$
② Ctrl + d
Ctrlを押しながらDを入力することで終了出来ます。
こちらが一番簡単ですが、2回Ctrl + Dを入力してしまうとターミナル自身が終了してしまうので注意が必要です。
[name]MacBook-Pro:[filename] [name]$ node
Welcome to Node.js v13.5.0.
Type ".help" for more information.
> (ここで Ctrl + dを入力)
[name]MacBook-Pro:[filename] [name]$
③ Ctrl + c を2回入力
[name]MacBook-Pro:[filename] [name]$ node
Welcome to Node.js v13.5.0.
Type ".help" for more information.
> (ここで Ctrl + cを入力)
(To exit, press ^C again or ^D or type .exit)
> (ここで Ctrl + cを入力)
[name]MacBook-Pro:[filename] [name]$
④ Ctrl + c の次に Ctrl + d
表示は、③と同じ表示になります。
②と同様に、二回Ctrl + dを入力してしまうとターミナル自身が終了してしまうので注意が必要です。
[name]MacBook-Pro:[filename] [name]$ node
Welcome to Node.js v13.5.0.
Type ".help" for more information.
> (ここで Ctrl + cを入力)
(To exit, press ^C again or ^D or type .exit)
> (ここで Ctrl + dを入力)
[name]MacBook-Pro:[filename] [name]$
最後に
ターミナル終了の可能性がない、①か②をおすすめします。