Chrome DevTools helps you find and fix problems in your Node.js code by letting you see what your program is doing step-by-step.
Chrome DevTools for Node.js in Node.js
node --inspect-brk your_script.js
Use --inspect-brk to start Node.js and pause on the first line for debugging.
After running this, open chrome://inspect in Chrome to connect the debugger.
app.js with debugging enabled and pauses before the first line.node --inspect-brk app.js
app.js with debugging enabled but does not pause at start.node --inspect app.js
node --inspect=9229 app.jsThis simple Node.js program adds two numbers and prints the result. You can run it with node --inspect-brk filename.js and use Chrome DevTools to step through each line, watch variables, and understand how the code runs.
console.log('Start'); function add(a, b) { const result = a + b; return result; } const sum = add(5, 7); console.log('Sum is:', sum);
Make sure you have Google Chrome installed to use Chrome DevTools.
Use chrome://inspect in Chrome to find and open your Node.js debugging session.
Remember to remove debugging flags when running your app in production.
Chrome DevTools lets you pause and inspect your Node.js code while it runs.
You start debugging by running Node.js with --inspect or --inspect-brk flags.
Use Chrome's chrome://inspect page to connect and debug your Node.js app visually.