How To Debug Javascript In Nodejs On Windows When I'm Not The Caller Of Node.exe
I'm trying to debug nodejs script (on Windows). I found that I can stop execution / set a breakpoint withing the script by using the 'debugger;' statement. However this seems to wo
Solution 1:
If you have the typical windows workspace such as Node, git and VSCode, you can do it in these simple steps:
- In VSCode, open
launch.json
configuration or create new by clicking on the wheel
- The node will listen on port 9229 by default, so add this configuration:
{"type":"node","request":"attach","name":"Attach to 9229","port":9229},
- Open Task Manager and locate the PID of your node process
I could identify my by the
"build"
folder where theindex.js
is. - open another
cmd
orgit-bash
and run this command, where21392
is the PID of your process.
node -e "process._debugProcess(21392)"
Everything should be ready now.
Post a Comment for "How To Debug Javascript In Nodejs On Windows When I'm Not The Caller Of Node.exe"