Tuesday, October 21, 2025

Debug node js file with visual studio code

With visual studio code, sometimes you may want to debug a node js file, but do not want to always enable debugger when you start node js files. 

In that case, you can set visual studio preference to 

Debug> javascript: Auto Attach Filter to 

onlyWithFlag

 

And then when you starts a node js file from terminal, set the --inspect flag will automatically enable debug for the current session. The below is an example

node --inspect myserver.js


If you do not want to enable js debugger, then just user

node myserver.js


No comments:

Post a Comment