Skip to content
Permalink
Browse files

docs: move and update inspector help

PR-URL: #1216
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
  • Loading branch information...
joshgav committed May 3, 2017
1 parent 490e7e5 commit 13eaf4c0fa678aa08fe5a241e8fa8b875a045c43
Showing with 116 additions and 0 deletions.
  1. +112 −0 locale/en/docs/inspector.md
  2. +4 −0 locale/en/site.json
@@ -0,0 +1,112 @@
---
title: Inspector Help
layout: docs.hbs
---

# Debugging Node.js Apps

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

This comment has been minimized.

Copy link
@eugeneo

eugeneo May 4, 2017

Contributor

This does not work on Windows.

Would it be better to describe the "process._debugProcess" API here?

This comment has been minimized.

Copy link
@joshgav

joshgav May 4, 2017

Author Member

@eugeneo this doc is as short as possible per @ofrobot's feedback, so I didn't mention an alternative to signals for Windows ;). Is there something short we could add here? cc @nodejs/platform-windows @digitalinfinity

The "Getting Started" guide is still around too at https://nodejs.org/en/docs/guides/debugging-getting-started/. Perhaps we should repurpose that as a deeper dive and document/discuss the JS APIs there too?

This comment has been minimized.

Copy link
@refack

refack May 4, 2017

Member

+1 for a few word on windows.

activate the debugger and print the connection URL.

---

## Inspector Tools & Clients

These commercial and open source tools make debugging Node.js apps easier.

### [node-inspect](https://github.com/nodejs/node-inspect)

* 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-inspect`
and invoked with `node-inspect myscript.js`.

### [Chrome DevTools](https://github.com/ChromeDevTools/devtools-frontend) 55+

* **Option 1**: Open `chrome://inspect` in a Chromium-based
browser. Click the Configure button and ensure your target host and port
are listed. Then select your Node.js app from the list.
* **Option 2**: Install the Chrome Extension NIM (Node Inspector Manager):
https://chrome.google.com/webstore/detail/nim-node-inspector-manage/gnhhdgbaldcilmgcpfddgdbkhjohddkj

### [VS Code](https://github.com/microsoft/vscode) 1.10+

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

### [Visual Studio](https://github.com/Microsoft/nodejstools)

* Choose "Debug > Start Debugging" from the menu or hit F5.
* [Detailed instructions](https://github.com/Microsoft/nodejstools/wiki/Debugging).

### [JetBrains WebStorm](https://www.jetbrains.com/webstorm/) 2017.1+ and other JetBrains IDEs

* Create a new Node.js debug configuration and hit Debug.

### [chrome-remote-interface](https://github.com/cyrus-and/chrome-remote-interface)

* Library to ease connections to Inspector Protocol endpoints.

---

## Command-line options

The following table lists the impact of various runtime flags on debugging:

<table cellpadding=0 cellspacing=0>
<tr><th>Flag</th><th>Meaning</th></tr>
<tr>
<td>--inspect</td>
<td>
<ul>
<li>Enable inspector agent</li>
<li>Listen on default port (9229)</li>
</ul>
</td>
</tr>
<tr>
<td>--inspect=<i>port</i></td>
<td>
<ul>
<li>Enable inspector agent</li>
<li>Listen on port <i>port</i></li>
</ul>
</td>
</tr>
<tr>
<td>--inspect-brk</td>
<td>
<ul>
<li>Enable inspector agent</li>
<li>Listen on default port (9229)</li>
<li>Break before user code starts</li>
</ul>
</td>
</tr>
<tr>
<td>--inspect-brk=<i>port</i></td>
<td>
<ul>
<li>Enable inspector agent</li>
<li>Listen on port <i>port</i></li>
<li>Break before user code starts</li>
</ul>
</td>
</tr>
<tr>
<td><code>node inspect <i>script.js</i></code></td>
<td>
<ul>
<li>Spawn child process to run user's script under --inspect flag;
and use main process to run CLI debugger.</li>
</ul>
</td>
</tr>
</table>

@@ -85,6 +85,10 @@
"link": "docs/faq",
"text": "FAQ"
},
"inspector": {
"link": "docs/inspector",
"text": "Inspector"
},
"api-lts": {
"link": "/dist/latest-%ver-major%/docs/api",
"subtext": "LTS",

0 comments on commit 13eaf4c

Please sign in to comment.
You can’t perform that action at this time.