/dev tips

🎊   The Modern DevTools course has now started! Visit ModernDevTools.com to find out more   🎊

(148) Show Timelime History Copy Stack Trace (150)

Chrome DevTools: Quick debugging of your Node.js code straight from DevTools

5th June 2017
Quick debugging of your Node.js code straight from DevTools

You can pass command line arguments to Node.js to specify a remote debugging session.

node --inspect --debug-brk node-script.js

Node will output something like this

Debugger listening on port 9229.
Warning: This is an experimental feature and could change at any time.
To start debugging, open the following URL in Chrome:
    chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/

Instead of copying and pasting that URL each time, your usual DevTools will display a small Node.js logo in the DevTools toolbar. Click on the icon and a dedicated instance of DevTools opens up for your running Node.js process.

Sign up to receive a developer tip, in the form of a gif, in your inbox each week.