electron: [Bug]: Developer Tools not showing (Electron v23.6.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 a bug report that matches the one I want to file, without success.
Electron Version
23.6.0
What operating system are you using?
Windows
Operating System Version
Windows 10 Home 22H2 19045.2251
What arch are you using?
x64
Last Known Working Electron version
No response
Expected Behavior
Developer Tools panel can be opened by user from Menu or can be started automatically when application starts.
Actual Behavior
The Developer Tools not showing at start and can’t be launched from Menu Panel (Toggle Developer Tools).
Testcase Gist URL
No response
Additional Information
The code used with my app:
const { app, BrowserWindow, ipcMain, shell, Notification } = require('electron');
const path = require('path');
const date = require('date-and-time');
const fs = require('fs');
const cmd = require('node-cmd');
const ExcelJS = require('exceljs');
const {getDesktopFolder} = require('platform-folders');
let windowsClosedIf = false;
let values1toIpcRenderer = {};
let sendToIpcRenderer = false;
const createWindow = () => {
// Create the browser window
const mainWindow = new BrowserWindow({
// frame: false,
autoHideMenuBar: false,
width: 800,
height: 650,
icon: __dirname + '/files/icon.ico',
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
mainWindow.loadFile(path.join(__dirname, 'index.html'));
mainWindow.webContents.openDevTools();
// mainWindow.webContents.setDevToolsWebContents(devtools.webContents);
// mainWindow.webContents.openDevTools({ mode: 'detach' });
setInterval(() => {
if (windowsClosedIf == false){
if (sendToIpcRenderer == true){
mainWindow.webContents.send('valuesTest', values1toIpcRenderer);
values1toIpcRenderer = {};
sendToIpcRenderer = false;
}
}
},500);
};
// If Electron is ready, create windows
app.on('ready', createWindow);
// If all windows are closed do...
app.on('window-all-closed', () => {
windowsClosedIf = true;
app.quit();
});
ipcMain.on('openExcel', function(event) {
// .
// .
// .
});
ipcMain.on('awsde2x', async function(event) {
// .
// .
// .
});
ipcMain.on('valsX2', async function(event, data) {
// .
// .
// .
});
My installed packages:
+-- date-and-time@2.4.1 +-- electron-builder@23.6.0 +-- electron@21.3.1 +-- exceljs@4.3.0 +-- fs@0.0.1-security +-- node-cmd@5.0.0 +-- nodemon@2.0.20 +-- path@0.12.7
±- platform-folders@0.6.0`
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 17 (2 by maintainers)
I got same trouble on 22.1.0 and finally I found a solution. I don’t know this is “right” approach but at least I can use Devtools
The same problem. win.webContents.openDevTools() does nothing. Last known electron version 17 without that problem. Not working with version 22, 23. 24, 25, 26, 27, 28. When openDevTools executing in terminal appears electron errors:
I solved the problem by removing app.commandLine.appendSwitch(‘no-sandbox’)