11

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:

enter image description here

I select the Option “Launch app.js” in Window “Debug”. The application run without problems. I put a breakpoint:

enter image description here

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...

Pause on breakpoint

Edited: I use OS X 10.10 (I tested it and it works perfectly in Ubuntu.)

1
  • here is demo how to configure nodjs express debugging in VSC wiki.workassis.com/… Commented Aug 19, 2016 at 12:23

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I had the node version 4.0.0 i have upgrade to 4.1.1 and it works perfectly =)
1

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.

3 Comments

Thanks for your answer. I followed the documentation VS Code debugging, but I do not work for me. The breakpoint is not displayed in yellow, and everything appears empty. It is very rare that I'm the only one who has this problem ... Screenshoot.
@jcabello Hmm.. that does appear to be inconsistent. What version of VS Code are you running at the moment? Try updating to the most recent version that was just released.
@tr_stringer I have the VS Code version 0.8.0. Is the latest version available. I use OS X Yosemite 10.10 thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.