How to do it...

This server can work just fine for months, but eventually, it crashes with log output mentioning allocation failure:

Eventually our server crashes

We can use the --inspect flag to start our server and initialize the Chrome Devtools Inspect Debugger protocol:

node --inspect index.js

We can now navigate Chrome to chrome://inspect, which should look something like the following screenshot:

If we click the inspect link in the Remote Target section this will open Devtools for our Node process.

Inspecting Node below v6.3.x If we need ...

Get Node Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.