I have the following debug configuration in my launch.json:
{
"type": "node",
"request": "attach",
"preLaunchTask": "npm: start",
"name": "Attach",
"port": 9090
}
This is task defined in tasks.json:
{
"type": "npm",
"script": "start",
"isBackground": true
}
npm start does this: node --inspect=9090 ./src/server.js
If I remove the preLaunchTask of the debug config, start the task manually, then start the debug session, everything works fine (the debug session attaches the the node process).
However, with the preLaunchTask, I get this error ~10 seconds after launching the debugging: "The specified task cannot be tracked".
It seems like maybe the task needs a problem matcher when it is set to isBackground, so I have also tried this task config with no success:
{
"type": "npm",
"script": "start",
"isBackground": true,
"problemMatcher": {
"background": {
"activeOnStart": true,
"beginsPattern": "^.*Using environment.*",
"endsPattern": "^.*listening.*"
}
}
}
The output of the npm: start
5:13:12 PM web.1 | Using environment: production
5:13:12 PM web.1 | Already up to date
5:13:12 PM web.1 | Debugger listening on ws://127.0.0.1:9090/22d582b8-eade-4b27-95f4-e36ad1718283
5:13:12 PM web.1 | For help see https://nodejs.org/en/docs/inspector
Do I need a problem matcher? If so, why? When I start the task by itself it's working fine. I don't have any problem to report...