I've run:
node debug f.js
And now I have a:
debug>
prompt. How can I toggle between the stuff I type into the terminal being interpreted as debug commands and it being fed to the script's stdin?
Debugging programs that read from stdin
is vastly easier after the inclusion of inspector
to node core in version 8+.
node --inspect-brk f.js
This will separate the debugger input out to a "remote" debugger allowing you to continue sending input into your program from command line.
I pulled the steps from this fantastic blog by Paul Irish
In VSCode, you can add a new Debug Configuration file with the property "console" set to "integratedTerminal".
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}\\index.js",
"console": "integratedTerminal"
}]
So now you can type into the terminal and debug your code.
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