Node.js
Debug Commands
Debug Node.js applications with the built-in inspector, Chrome DevTools, and VS Code integration. Set breakpoints, inspect memory, and profile CPU usage.
12 commands
Pro Tips
Use 'node --inspect-brk app.js' to pause on the first line, then open chrome://inspect to connect.
Add 'debugger;' statements in code for programmatic breakpoints — works with any inspector client.
Use NODE_DEBUG=http,net to get verbose debug logging from Node.js core modules without code changes.
Common Mistakes
Never expose --inspect on 0.0.0.0 in production. The debug port allows arbitrary code execution.
Leaving debugger statements in production code causes the process to pause if an inspector connects.