I try to debug a Project in node JS with Visual Studio Code but i don't achieve. I have built a simple project with the next commands:
express myExpressApp
cd myExpressApp
npm install
npm start
My file launch.json:
I select the Option “Launch app.js” in Window “Debug”. The application run without problems. I put a breakpoint:
I give in Chrome the address: http://localhost:3000/
Visual Studio Code says: “Pause on breakpoint”, but I don't see anything, I can press Continue and the application continues...
Edited: I use OS X 10.10 (I tested it and it works perfectly in Ubuntu.)
VSCode 0.8.0 has problems with node versions older than 0.12.0. Upgrade to at least 0.12.0 or wait for the upcoming VSCode 0.9.0.
When debugging with Visual Studio Code, there are many things you can do when you hit a breakpoint.
In order to go to the "debugging" view, you can either click the "bug" icon on the left or hit Ctrl + Shift + D
.
You see Paused on breakpoint.
in the Call Stack window. That window includes the callstack and you can double-click the different frames to navigate through the corresponding source.
You can also see the Variables window here to see the values of the variables (local/global/closure/etc.).
One of the more used functionality parts of debugging in VS Code is the debug console. In the debugging view, there's a little icon right next to the configuration that you're using that looks like the CLI character. You can either click that or just do a command palette search (Ctrl + Shift + P
) for Debug: open Console
. This will bring up the debugging console for your ad hoc debugging commands.
The documentation on VS Code debugging is quite robust, too, so I recommend you take a look at this.
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