VSCode breakpoints not working

VSCode breakpoints or debugger statements are not hit, why?

I was trying to debug a Node program with VSCode and npm. Neither the breakpoints or debugger statements would pause execution. After some Internet searches I found that you can add "trace": "verbose" to your launch config. Ex:

  "type": "node",
  "request": "launch",
  "name": "Launch via NPM",
  "runtimeExecutable": "npm",
  "runtimeArgs": [
  "port": 9229,
  "trace": "verbose"

With this setting on, I launched the program and got logs like this:

Getting browser and debug protocol version via
Discovering targets via
HTTP GET failed: Error: connect ECONNREFUSED
There was an error connecting to : connect ECONNREFUSED
HTTP GET failed: Error: connect ECONNREFUSED

This is of interest: ECONNREFUSED on port 9229, the connection was refused by the server. So, the server/port aren't available. To do that you just have to modify your script launch command like this:

  "scripts": {
    "debug": "node --nolazy --inspect-brk=9229 myProgram.js"

This recipe is already documented in the vscode site and I would have seen it if I had gone through the docs instead of just poking around the UI first.

Gastón I. Silva