I have this simple program:
process.stdin.once("data", function (data) {
console.log("You said your name is " + data);
process.stdin.pause();
});
console.log("What is your name?");
process.stdin.resume();
Now I put a breakpoint inside a callback:
And run the program, the console
tab is open:
But whatever I type into the terminal in this console
tab doesn't trigger a breakpoint. It seems that this console
tab is not a terminal used to accept input from a user.
To start debugging, hold Ctrl+Shift and click the link. WebStorm starts a debugging session with an automatically generated Attach to Node. js/Chrome configuration.
Click the gutter next to the executable line of code where you want to set a breakpoint. Alternatively, place the caret at this line and press Ctrl+F8 . To set a temporary line breakpoint, press Ctrl+Alt+Shift+F8 . The breakpoint will be removed from your project right after it is hit.
While debugging, make sure that "Use Console Input" toggle button on console's toolbar is NOT pressed - when it's pressed, console is in 'live' mode, all entered expressions are evaluated, so stdin is disabled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With