electron: openDevTools() not working since version 6.0.0
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for an issue that matches the one I want to file, without success.
Issue Details
- Electron Version:
- Tried versions 6.0.0, 6.0.6 and 6.0.7
- Operating System:
- Windows 7 x64
- Last Known Working Electron version:
- 5.0.10
Expected Behavior
I’m trying to open the dev console.
Actual Behavior
Dev console does not open.
To Reproduce
- Clone the Electron quick start from here: https://github.com/electron/electron-quick-start It’s currently using electron 6.0.6.
npm installnpm start- Press Ctrl+Shift+I or select from the menu to toggle the dev tools
- nothing happens
Uncommenting line 23 in main.js (mainWindow.webContents.openDevTools()) does not help either.
Older version:
- in package.json, set devDependencies/electron to 5.0.10
npm installnpm start- Dev tools open just fine.
Screenshots
Additional Information
Edit: Just updated my Google Chrome to 76 (from 75) and the dev tools open just fine (in both).
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 30 (1 by maintainers)
Commits related to this issue
- fix(background): enable electron devtools Open a new window for the electron devtools. This workaround is necessary due to an issue in an old version of electron: https://github.com/electron/electron... — committed to Tommytrg/sheikah by Tommytrg 2 years ago
- fix(background): enable electron devtools Open a new window for the electron devtools. This workaround is necessary due to an issue in an old version of electron: https://github.com/electron/electron... — committed to Tommytrg/sheikah by Tommytrg 2 years ago
I ran into the problem running Windows in a VM under macOS, files shared from the host through a mapped network drive. I found out that
setDevToolsWebContents(documented here) make DevTools appear.Copying the example for simplicity:
Tested with Electron 7.1.4.
I have the same problem with
electron@25.1.0. NeithersetDevToolsWebContentssolution nor “close-and-open” solution worked for me.However, I discovered that the “wait-and-open” solution works for some reason.
hey I am using electron version 10. I too have the same issue but I managed to access the devtools in the browser following these steps. ~right click the index.html and open it in the browser ~ctrl+shift+I and there you are.
Works also on Electron v8. Thanks! This guy needs a price
In my case the problem was that before executing
openDevTools()the open state of devtools was alreadytrue, even though it was not visible. In this case,openDevTools()does nothing (at least on Windows).Solution 1: always execute
closeDevTools()before executingopenDevTools():Solution 2: implement a toggle functionality:
Anyone having this issue? Im reproducing exactly this steps with electron-quick-start and dev tools never opens.
Node.js 12.4.0, Chromium 76.0.3809.146 Electron 6.0.9.
Hi, I also have the problem of devtools that don’t load, so I add
mainWindow.webContents.openDevTools({ mode: 'detach' })aftermainWindow.loadFile('index.html')and it works for me
I can confirm that the issue only appears when the project is running from a network drive. If I move it to a local drive the devtools open just fine.
Also, I tested version 8.0.0, same issue.
Digging a bit more I realized for my users it works fine if they open the app locally, cause normally we use a remote directory for the app, that way I can update it in real time for all my team. So this could be linked to the admin access mentioned by @jjustin3 I hope there is a workaround for this use-case.
Had this problem recently and found something that worked for me… I assume y’all are on Windows, so try running your terminal/command prompt/powershell in a non-admin mode. This eliminated the issue of devtools not opening up for me.
Edit: It is worth noting that I also had this problem on an older version and thought it was the terminal I was using that was causing the issue. This belief was due to the me switching from the old terminal to git-bash, which alleviated the problem. However, looking back I now realize that the old terminal I was using was running in admin and git-bash wasn’t until I started running it in admin a week ago. When I changed this a week ago, the problem started again. Therefore, this problem isn’t specific to a particular Electron version (could be the past few perhaps?). I hope this background info will help someone out in the future until the underlying issue is determined.
i had an issue opening the dev tools when using electron via
npx electron file.js. i resolved it by installingelectronand running it viayarn electron file.jsHappened to me when I updated to 18.0.3 from 16. The solution above works for me luckily
That did the trick. Thank you!
in 9.0.0-beta.7 the dev tools also not appear if app is running as admin