简体   繁体   中英

When does Node's REPL get “stuck”?

Sometimes, when you type enter after a correct finished statement, the REPL waits for more :

> var f; function(){};
... 

When exactly does that happen ? I didn't found any documentation on that.

Your code is not correct. When run from a file, a syntax error is reported:

SyntaxError: Unexpected token (

There was a bug in REPL where in the case of a syntax error, REPL assumed the code to evaluate is not complete and would span multiple lines. Regardless of the type of syntax error.

The issue was fixed in v0.11.7 by commit 9ef9a9d . See the commit message for more details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM