electron/docs/tutorial/debugging-main-process.md
Kyle Hornberg 0097f89adb Correct link of debugging UI
Using the link provided one receives a response of `Cannot GET /[object%20Object]`.

I've tested this on electron 0.25.3 using the example application and node-inspector version 0.10.0.
The url change is the url provided by node-inspector in the terminal window.
2015-05-12 10:29:00 -05:00

1.2 KiB

Debugging the main process

The devtools of browser window can only debug the renderer process scripts. (I.e. the web pages.) In order to provide a way to debug the scripts of the main process, Electron has provided the --debug and --debug-brk switches.

Command line switches

--debug=[port]

When this switch is used Electron would listen for V8 debugger protocol messages on port, the port is 5858 by default.

--debug-brk=[port]

Like --debug but pauses the script on the first line.

Use node-inspector for debugging

Note: Electron uses node v0.11.13, which currently doesn't work very well with node-inspector, and the main process would crash if you inspect the process object under node-inspector's console.

1. Start the node-inspector server

$ node-inspector

2. Enable debug mode for Electron

You can either start Electron with a debug flag like:

$ electron --debug=5858 your/app

or, to pause your script on the first line:

$ electron --debug-brk=5858 your/app

3. Load the debugger UI

Open http://127.0.0.1:8080/debug?ws=127.0.0.1:8080&port=5858 in the Chrome browser.