Hacker News new | past | comments | ask | show | jobs | submit login

It somewhat blew my mind the other day that you can add an '--inspect' flag to a locally-run node instance and inspect it via Chrome (chrome://inspect).

After building a server for many months now, and relying on far too many console.log()s, this trick has enlightened me to the point where I feel as though I was a fool for not finding it out before!

Ndb looks like a promising improvement over this functionality and I'm excited to check it out.




Recently I discovered that you can flip to debug mode even on already running process without debug mode by doing 'process._debugProcess(<pid_of_process>)' on any other node process. This has made my life incredibly simpler by not having to remember whether I had run my app in debug mode with '--inspect' flag.


IIRC, `process._debugProcess` just sends a SIGUSR1 to the provided PID.


That sounds pretty cool actually... I have my --inspect flag baked into an npm command already, but I think I might just play around with that for fun haha


Try --inspect-brk so that the Chrome debugger stops immediately and you have the time to set your breakpoints.


Will give it a whirl, thank you!


Had you any experience with breakpoint based debugging in the past in any environment? I'm always surprised when I run into someone who has never tried getting it going and has always relied on print statements.


To be clear, this was a genuine question. I have colleagues who generally develop software using log statements exclusively and I was curious about whether or not this was the parent's experience.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: