Many tools and libraries are available to help you debug your Node.js apps. Some of these are listed below.
To connect manually rather than with a tool, pass the --inspect flag and connect to the printed URL.
If a process was started without
--inspect, signal it with SIGUSR1 to
activate the debugger and print the connection URL.
These commercial and open source tools make debugging Node.js apps easier.
- A CLI debugger developed at https://github.com/nodejs/node-inspect.
- Bundled with Node and invoked with
node inspect myscript.js.
- Can also be installed independently with
npm install -g node-inspectand invoked with
- Option 1: Open
chrome://inspectin a Chromium-based browser. Click the "Open dedicated DevTools for Node" link.
- Option 2: Install the Chrome Extension NIM (Node Inspector Manager): https://chrome.google.com/webstore/detail/nim-node-inspector-manage/gnhhdgbaldcilmgcpfddgdbkhjohddkj
VS Code 1.10+
- In the Debug panel, click the settings icon to open
.vscode/launch.json. Select "Node.js" for initial setup.
- Choose "Debug > Start Debugging" from the menu or hit F5.
- Detailed instructions.
JetBrains WebStorm 2017.1+ and other JetBrains IDEs
- Create a new Node.js debug configuration and hit Debug.
- Library to ease connections to Inspector Protocol endpoints.
The following table lists the impact of various runtime flags on debugging: