thesearentthedroids
thesearentthedroids

Reputation: 620

VS Code nodejs distant debugging: breakpoints are getting ignored

I'm trying to set up a distant debug with VS Code on a node.js (7.1.0) project.

I launch my dev app with pm2:

{
  "apps": [{
    "name": "my-app-dev",
    "script": "app.js",
    "watch": true,
    "node_args": ["--inspect=9229", "--nolazy"],
    "ignore_watch": ["assets/images/", ".tmp/", ".git/"],
    "watch_options": {
      "usePolling": true
    }
  }]
}

this is the .vscode/launch.json file:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node2",
            "request": "attach",
            "name": "attach",
            "port": 9229,
            "address": "my.app.local",
            "restart": true,
            "diagnosticLogging": true,
            "sourceMaps": false
        }
    ]
}

When I start the debugger I successfully get attached Debugger attached.

The problem is my breakpoints are getting ignored: Unverified breakpoint

Upvotes: 4

Views: 1885

Answers (1)

thesearentthedroids
thesearentthedroids

Reputation: 620

finally found a solution by adding

"localRoot": "${workspaceRoot}/api",
"remoteRoot": "/srv/www/my-app/api"

to my launch.json.

If someone can explains why its needed :o

Upvotes: 4

Related Questions