Node.js cli options debugging

--inspect Enable inspector agent; Listen on default address and port (127.0.0.1:9229)

--inspect-brk Enable inspector agent; Listen on default address and port (127.0.0.1:9229); Break before user code starts

--inspect=[host:]port
Allows attching Chrome Devtools(chrome://inspect) and IDEs to Node.js instances.

--throw-deprecation
Throw errors for deprecations.

--trace-warnings
Print stack traces for process warnings

Example

node --inspect server.js

Inspector clients

Chrome DevTools

Open chrome://inspect in a Chromium-based browser

Visual Studio Code

In the Debug panel, click the settings icon to open .vscode/launch.json. Select “Node.js” for initial setup.