electron/docs/tutorial/debugging-main-process.md

34 lines
1 KiB
Markdown
Raw Normal View History

2015-09-01 02:12:57 +00:00
# Debugging the Main Process
The DevTools in an Electron browser window can only debug JavaScript that's
executed in that window (i.e. the web pages). To debug JavaScript that's
executed in the main process you will need to use an external debugger and
2017-06-06 21:30:45 +00:00
launch Electron with the `--inspect` or `--inspect-brk` switch.
2015-09-01 02:12:57 +00:00
## Command Line Switches
Use one of the following command line switches to enable debugging of the main
process:
2017-05-15 16:34:55 +00:00
### `--inspect=[port]`
2017-05-15 16:34:55 +00:00
Electron will listen for V8 inspector protocol messages on the specified `port`,
an external debugger will need to connect on this port. The default `port` is
`9229`.
2016-10-31 16:27:42 +00:00
```shell
electron --inspect=9229 your/app
```
2016-10-31 16:27:42 +00:00
2017-05-15 16:34:55 +00:00
### `--inspect-brk=[port]`
2017-11-06 00:23:18 +00:00
Like `--inspect` but pauses execution on the first line of JavaScript.
## External Debuggers
2017-05-15 16:34:55 +00:00
You will need to use a debugger that supports the V8 inspector protocol.
2017-05-15 16:40:00 +00:00
- Connect Chrome by visiting `chrome://inspect` and selecting to inspect the
launched Electron app present there.
- [Debugging in VSCode](debugging-vscode.md)