Ajay Kumar
Ajay Kumar

Reputation: 1164

VSCode Debug Node app using Inspector protocol

I am running node app using pm2 with --inspect flag. I am able to debug my app on the following url:

chrome-devtools://devtools/remote/serve_file/@62cd277117e6f8ec53e31b1be58290a6f7ab42ef/inspector.html?experiments=true&v8only=true&ws=local.abc.com:9003/node

How can I debug this application using VS Code built in debugger?

Upvotes: 3

Views: 1899

Answers (1)

Andre Weinand
Andre Weinand

Reputation: 1977

If you have launched your node app from the command line create this "attach" launch config:

{
    "type": "node",
    "request": "attach",
    "name": "Attach",
    "port": 9222,
    "protocol": "inspector"
}

or let VS Code launch your app and attach to it in one go:

{
    "type": "node",
    "request": "launch",
    "name": "Launch Program",
    "program": "${workspaceRoot}/your_app.js",
    "protocol": "inspector"
}

Upvotes: 1

Related Questions