Visual Studio Code - Debugging with "Attach" does not work on Mac OS

I am trying to debug my node js project on Mac. It works very well in Launch mode, but not in Attach mode. In "Attach" mode, when I start debugging, I see that VS Code first tries to start the debugger in a matter of seconds and then suddenly stops without showing any error messages. I leave everything at its defaults {"name": "Attached", "type": "node", "address": "localhost", "port": 3000}, and I'm sure I'm running the http site : // localhost: 3000

+3


source to share


1 answer


I got a response from MS support team, now it works like a champion :) Love VSCode and the team so much.

Below is the answer from Andre Weinand of the VSCode team:

In "Attach" mode, the VSCode debugger must connect to the node debug port, which by default uses port 5858. The debugger cannot access the "site" your node program is serving.



So please make sure you are running your node program with the correct debug arguments, eg. node --debug-brk program.js or node --debug-brk = 3000 program.js

The former uses the default port 5858 and you will have to change the Attach launch configuration accordingly. The second changes the port to 3000, which should work with your Attach launch configuration.

+8


source







All Articles