openDevTools() has suddenly stopped working on my machine


#1

Hello Electron community!

I have recently started building a React/Electron app using this boilerplate: https://github.com/pbarbiero/basic-electron-react-boilerplate

In the main.js file I initialize my browser window as follows:

mainWindow = new BrowserWindow({
    width: 350, 
    height: 800
  });

mainWindow.once('ready-to-show', () => {
    mainWindow.show();
    mainWindow.webContents.openDevTools();
});

Yesterday I decided to add the {mode: 'detach'} option to openDevTools(). This caused my devtools to disappear entirely. I reverted the change and devtools never reappeared.

However, devtools continues to appear on other peoples’ machines. I have tried pulling down my repo into a new directory with fresh node_modules, but to no avail.

Does anyone know what might have caused devtools to stop working on my machine specifically? I was working in Node 9.0.0, and my coworker (for whom devtools still appears) was using Node 9.9.0.

I have reverted to earlier git commits where my devtools was definitely appearing, but it no longer does.

Your help is appreciated!


#2

How are you running Electron? The executable is basically the core browser component of Chrome, and it has a lot of the same behaviors, like the dev tools remembering how you had them last time. I suspect that using a new Electron binary would solve your problem. If you’ve installed it globally with NPM, then changing your code folder would not have an effect and you would see the same behavior across multiple projects.


#3

Thanks for your reply!

I’m running Electron as a package inside my project – one of my node_modules, to be exact. I assumed that every time I delete and regenerate my node_modules folder, I’m getting a fresh install of Electron, React, Webpack, etc.

Is there anywhere else I should be looking to reset the devtools behavior in the browser component?


#4

If it’s local, I’m not sure why it’s remembering the dev tools state across reinstalls. Have you tried across multiple projects? What happens if you clone the repo to another computer and use npm install? You only explicitly mentioned testing with the same project, same computer, but new directory.