# electron-debug

> Adds useful debug features to your Electron app

Latest version **5.0.0** (published 2026-09-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install electron-debug
pnpm add electron-debug
yarn add electron-debug
bun add electron-debug
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2026-09-20 |
| First published | 2015-06-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=22 |
| Dependencies | 1 |
| Unpacked size | 13.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 779 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | electron, debug, debugging, devtools, app, dev, development |

## Links

- npm: https://www.npmjs.com/package/electron-debug
- Repository: https://github.com/sindresorhus/electron-debug
- Homepage: https://github.com/sindresorhus/electron-debug#readme
- Issues: https://github.com/sindresorhus/electron-debug/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/electron-debug

## Dependencies (1)

- [electron-is-dev](https://npm.io/package/electron-is-dev.md) ^3.0.1

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 5.0.0 (latest) — 2026-09-20
- 4.1.0 — 2024-10-14
- 4.0.1 — 2024-08-12
- 4.0.0 — 2024-05-01
- 3.2.0 — 2020-12-21
- 3.1.0 — 2020-05-22
- 3.0.1 — 2019-06-29
- 3.0.0 — 2019-05-10
- 2.2.0 — 2019-04-06
- 2.1.0 — 2019-01-28
- 2.0.0 — 2018-05-28
- 1.5.0 — 2018-01-02
- 1.4.0 — 2017-08-05
- 1.3.0 — 2017-07-23
- 1.2.0 — 2017-06-22
- … 17 more at https://npm.io/package/electron-debug/versions

## README

# electron-debug

> Adds useful debug features to your [Electron](https://electronjs.org) app

## Features

### DevTools

Toggle DevTools.

- macOS: <kbd>Cmd</kbd> <kbd>Alt</kbd> <kbd>I</kbd> or <kbd>F12</kbd>
- Linux: <kbd>Ctrl</kbd> <kbd>Shift</kbd> <kbd>I</kbd> or <kbd>F12</kbd>
- Windows: <kbd>Ctrl</kbd> <kbd>Shift</kbd> <kbd>I</kbd> or <kbd>F12</kbd>

### Reload

Force reload the window.

- macOS: <kbd>Cmd</kbd> <kbd>R</kbd> or <kbd>F5</kbd>
- Linux: <kbd>Ctrl</kbd> <kbd>R</kbd> or <kbd>F5</kbd>
- Windows: <kbd>Ctrl</kbd> <kbd>R</kbd> or <kbd>F5</kbd>

### Element Inspector

Open DevTools and focus the Element Inspector tool.

- macOS: <kbd>Cmd</kbd> <kbd>Shift</kbd> <kbd>C</kbd>
- Linux: <kbd>Ctrl</kbd> <kbd>Shift</kbd> <kbd>C</kbd>
- Windows: <kbd>Ctrl</kbd> <kbd>Shift</kbd> <kbd>C</kbd>

## Known limitations

The shortcuts only work while the app window has focus. Electron does not deliver keyboard input to the DevTools web contents, so there is no way to detect the shortcut while DevTools itself has focus. Click the app window first, then use the shortcut.

## Install

```sh
npm install electron-debug
```

*Requires Electron 44 or later.*

## Usage

```js
import {app, BrowserWindow} from 'electron';
import debug from 'electron-debug';

debug();

let mainWindow;
(async () => {
	await app.whenReady();
	mainWindow = new BrowserWindow();
})();
```

## API

Only runs when in [development](https://github.com/sindresorhus/electron-is-dev), unless overridden by the `isEnabled` option. So no need to guard it for production.

### debug(options?)

Install keyboard shortcuts and optionally activate DevTools on each `BrowserWindow`, including the ones that already exist when this is called.

#### options

Type: `object`

##### isEnabled

Type: `boolean`\
Default: [Only in development](https://github.com/sindresorhus/electron-is-dev)

##### showDevTools

Type: `boolean`\
Default: `true`

Show DevTools on each `BrowserWindow`.

##### devToolsMode

Type: `string`\
Default: `'previous'`\
Values: `'undocked'` `'left'` `'right'` `'bottom'` `'previous'` `'detach'`

The dock state to open DevTools in.

##### windowSelector

Type: `(window: BrowserWindow) => boolean | Partial<Options>`\
Default: `() => true` (Use the global options for every window)

Specify customized options for each window.

The given function receives the window to apply the filter or new options to.

It must return one of these values:
- `true`: To enable debug with the global options for the given window.
- `false`: Disable debug for the given window (same as returning `{isEnabled: false}`).
- `Partial<Options>`: Object to override global options just for the given window. It does a shallow merge.

### devTools(window?)

Toggle DevTools for the specified `BrowserWindow` instance or the focused one.

#### window

Type: `BrowserWindow`\
Default: The focused `BrowserWindow`

### refresh(window?)

Reload the specified `BrowserWindow` instance or the focused one.

#### window

Type: `BrowserWindow`\
Default: The focused `BrowserWindow`

### openDevTools(window?)

Open DevTools for the specified `BrowserWindow` instance or the focused one.

#### window

Type: `BrowserWindow`\
Default: The focused `BrowserWindow`

## Related

- [electron-util](https://github.com/sindresorhus/electron-util) - Useful utilities for developing Electron apps and modules
- [electron-store](https://github.com/sindresorhus/electron-store) - Save and load data like user settings, app state, cache, etc
- [electron-context-menu](https://github.com/sindresorhus/electron-context-menu) - Context menu for your Electron app
- [electron-dl](https://github.com/sindresorhus/electron-dl) - Simplified file downloads for your Electron app
- [electron-unhandled](https://github.com/sindresorhus/electron-unhandled) - Catch unhandled errors and promise rejections in your Electron app
- [electron-reloader](https://github.com/sindresorhus/electron-reloader) - Simple auto-reloading for Electron apps during development
- [electron-serve](https://github.com/sindresorhus/electron-serve) - Static file serving for Electron apps

---
_Source: https://npm.io/package/electron-debug · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
