Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 386
Ajay Kumar Avatar asked Dec 05 '25 10:12

Ajay Kumar


1 Answers

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"
}
like image 95
Andre Weinand Avatar answered Dec 07 '25 10:12

Andre Weinand