I recently had the strange - and only occasionally - occuring problem that a node process I wanted to debug would just freeze on startup. Here's how I solved it.
It appeared only now and then. I would hit the debug button in my IDE, the debugging panel would open - showing the console. Appearently, the node process started fine, opened the debugging port and the IDE connected. But then, nothing.
The interesting thing was that when changing the node executable, the script would run again. Sometimes. But switching between
node or locally installed versions through
npm all the time isn't fun. I almost wanted to give up but well - I code for a living...
Listen to your belly
After a couple of days when I it happened again, I had a thought: What if some security software messes around with the process? I opted for Windows Defender when installing Windows 10 on my machine and never had a problem with it. But from experience, I recall lots of problems with antivirus or firewall software in the past.
So I tried disabling realtime monitoring of Windows Defender. Node worked fine. Like, all the time. Oh man. Looks like something in node or Windows Defender changed recently that made Defender think the node debugger is evil code execution.
Leaving realtime monitoring off is not an option. But luckily, you can define files and folders for Windows Defender to ignore. Since I trust my own code, I added my folder to the exceptions that contains all my work projects. I never had a problem again ✌️