electron: [Bug]: Devtools won't open

Preflight Checklist

Electron Version

18.0.1

What operating system are you using?

Other Linux

Operating System Version

Linux mabel-endeavour-linux 5.15.32-xanmod1-1 #1 SMP Tue, 29 Mar 2022 10:56:09 +0000 x86_64 GNU/Linux

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

I launch my application, I press ctrl+shift+i, and devtools appears.

Actual Behavior

I do the above, and the devtools console briefly flashes, before disappearing. the page is still formatted as though the devtools window is up (less horizontal space), but with a blank background where the devtools window should be. Re-entering the key-combo does not change the formatting back.

log:

[mabel@mabel-endeavour-linux electron-test]$ electron .
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../include/c++/11.2.0/bits/unique_ptr.h:659: typename std::add_lvalue_reference<element_type>::type std::unique_ptr<blink::CSSSelector []>::operator[](std::size_t) const [_Tp = blink::CSSSelector [], _Dp = std::default_delete<blink::CSSSelector []>]: Assertion 'get() != pointer()' failed.
[10179:0408/145319.700844:ERROR:shared_image_manager.cc(227)] SharedImageManager::ProduceSkia: Trying to Produce a Skia representation from a non-existent mailbox.
[10179:0408/145319.701892:ERROR:shared_image_manager.cc(227)] SharedImageManager::ProduceSkia: Trying to Produce a Skia representation from a non-existent mailbox.
[10179:0408/145319.702470:ERROR:shared_image_manager.cc(227)] SharedImageManager::ProduceSkia: Trying to Produce a Skia representation from a non-existent mailbox.
[10179:0408/145319.703007:ERROR:shared_image_manager.cc(227)] SharedImageManager::ProduceSkia: Trying to Produce a Skia representation from a non-existent mailbox.

Testcase Gist URL

No response

Additional Information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 34 (4 by maintainers)

Most upvoted comments

Also had the same issue with devtools not opening when running from vs code terminal. But adding mainWindow.webContents.openDevTools({ mode: 'detach' }) just before mainWindow.loadURL() works everytime it seems.

Thank you for this update. While it’s good to know that newer versions of Electron are no longer encountering this issue, it’s important to acknowledge that there are still developers who are working with older versions and are forced to use Electron 13 or lower. With that in mind, I would like to suggest a workaround for those who are still experiencing this issue on unsupported versions of Electron.

Just use the remote debugger. The built-in debugger has too many problems on earlier versions of Electron.

  1. Enable Chrome’s remote debugger by setting the --remote-debugging-port switch. this code to the main process

    (Main process)

    app.commandLine.appendSwitch("--remote-debugging-port", "9222");
    
  2. Go to chrome://inspect in a Chromium-based browser Your BrowserWindow should appear.

Tested with Electron 9.4.4

With electron 21.3.1 the DevTools do not open when the app is launched from the Visual Studio Code terminal. They do open when launching from a system terminal.

Adding what I hope is helpful information:

In the following apps built with Electron, devtools renders similar to the screenshot attached:

vscode (recent update) Obsidian Typora

My system info:

Kernel: 5.15.71-1-lts
arch: x86_64 bits: 64
Desktop: i3 v: 4.21 
Distro: EndeavourOS - Linux

2022-10-11_02-43-42_flameshot

bump

Also @Curstantine are you also running Endeavour?

that is, in fact, a slightly more correct description of what happens.