Reputation: 71
I want to debug node like this in terminal:
$sudo node app
But, in vscode, I don't know where I can configure it.
This is my launch.json. Nothing has helped,
Upvotes: 7
Views: 7472
Reputation: 409
First, create attach process config:
{
"name": "Attach to Process",
"type": "node",
"request": "attach",
"port": 9222
}
and run it.
Second, run node to debug like this.
sudo node --inspect=9222 app.js
Upvotes: 3
Reputation: 181
I have the same issue. I'm trying to debug an app that connects to port 443 on a Mac. In order to get around the problem I've been using I added the following to my package.json under scripts.
"debug": "sudo devtool server.js",
With this you can debug, just not as nice since you are using the chrome debugger verses the one in vscode. You will need to have devtool from chrome installed for this to work.
Upvotes: 0
Reputation: 629
In order to run the command as sudo you have to launch VS code under sudo. Here's how you do that ...
Upvotes: 6