How to debug child Node.JS process in Visual Studio Code?
问题 How to debug child Node.JS process in VS Code? Here is the example of the code that I'm trying to debug: var spawn = require('child_process').spawn; var scriptPath = './child-script.js'; var runner_ = spawn('node', [scriptPath]); 回答1: You can easily add a new launch configuration to launch.json that allows you to attach to a running node instance with a specific port: { "name": "Attach to Node", "type": "node", "address": "localhost", "port": 5870, } Just make sure you fork/spawn your node