`node --inspect` Is the Command You Reach For When `console.log` Has Stopped Being Enough and You Need a Real Debugger Attached to the Process
A practical guide to `node --inspect` for starting a Node.js process with debugging enabled so breakpoints and runtime inspection can replace blind logging.
Why this command matters: there is a point where more
console.logoutput stops being debugging and starts being denial.
When you need breakpoints, stack inspection, variable state, or step-through execution in a Node.js process, node --inspect is the command that opens the real debugger path.
The command
node --inspect app.jsFor a process that should break immediately:
node --inspect-brk app.jsThat second form is especially useful when the bug happens during startup and you cannot attach quickly enough after launch.
Why it helps
It is useful when:
- startup logic fails before logs become meaningful
- async state is too hard to reason about from prints
- values differ from what your logging made you think
- you need to inspect the call path interactively
This is where proper debugging earns its keep.
Final recommendation
If a Node process needs real inspection instead of another logging spree, start it with node --inspect or --inspect-brk. It is still one of the fastest ways to graduate from guess-heavy debugging to actual runtime visibility.