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.jsonconfiguration 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.jsis.
- open another
cmdorgit-bashand run this command,
where21392is 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"