Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug an interactive Node.js app in VS Code?

How do you run and debug an interactive Node.js app (one that prompts the user to enter STDIN on the console) in VS Code using a simple launch (F5). I have so far been running the app using node --inspect-brk . and then attaching VS Code. This works fine, but I'm just wondering if there's a faster way. If I look at the DEBUG CONSOLE pane, I can see the STDOUT, but I can't add input there.

like image 437
Jeremy Foster Avatar asked Oct 22 '25 20:10

Jeremy Foster


1 Answers

Randy's comment was my answer with a link here. Thanks, Randy.

The solution is to configure the console value in your launch.json file. I added "console": "integratedTerminal" and now when I hit F5 I can jump to the integrated terminal (CTRL+<backtick>) and interact with my app.

like image 126
Jeremy Foster Avatar answered Oct 26 '25 06:10

Jeremy Foster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!