Debugging Node.js with Chrome DevTools
(post updated August 2016)
Here’s how to get up and running:
- Download and install the current version of node.
A nightly build was previously required, but support is in node as of v6.3.0.
3. Run it with the
▸ node --inspect index.js
You can also break on the first statement of the script with
▸ node --inspect --debug-brk index.js
4. Open the provided URL
You’ll get a url starting with “chrome-devtools://..” to copy/paste into Chrome. After dropping it in, you’ll have all the Chrome DevTools features you’re used to:
- Complete breakpoint debugging, stepping w/ blackboxing
- Source maps for transpiled code
- Console evaluation with ES6 feature/object support and custom object formatting
- Heap snapshot inspection, heap allocation timeline, allocation profiling
- Asynchronous stacks for native promises