I believe what’s happening is that VSCode by default will pick random port for debugger communication and then generate a node debug command with the port set to the randomly chosen port.

However, if you override or fix the command that VSCode would be using to assign the port such as --debug-brk or --inspect then it cannot do this and blindly assumes your command is correct. You would also need to set the port property in your launch configuration and then make it match the command. E.g. if you set port: 58585 also set --debug-brk=58585 so they match

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store