MarshallOfSound / electron-devtools-installer

An easy way to ensure Chrome DevTools extensions into Electron
MIT License
1.13k stars 138 forks source link

React developer tools sometimes can't be loaded #147

Open jwir3 opened 4 years ago

jwir3 commented 4 years ago

Apologies if this is something misconfigured with my environment or a misunderstanding on my part, but I'm seeing an issue where the REDUX_DEVTOOLS is injected into the electron instance, but REACT_DEVELOPER_TOOLS fails. Here's how we're loading the tools:

      installExtension([REDUX_DEVTOOLS)
        .then((name) => global.logger.info(`Added extension: ${name}`, {'class' : 'main'}))
        .catch((err) => console.log('An error occurred while trying to add redux devtools: ', err));

      installExtension(REACT_DEVELOPER_TOOLS)
        .then((name) => global.logger.info(`Added extension: ${name}`, {'class' : 'main'}))
        .catch((err) => console.log('An error occurred while trying to add react devtools: ', err));

And, when our application is launched, it responds with:

[09:45:25] [Main] [INFO] [main] Added react and redux developer tools extensions: Redux DevTools

and, then, later:

An error occurred while trying to add react devtools:  Error: Exited with code 9
    at ChildProcess.<anonymous> (/Users/<username>/Source/<project>/node_modules/cross-unzip/index.js:38:21)
    at ChildProcess.emit (events.js:210:5)
    at ChildProcess.EventEmitter.emit (domain.js:476:20)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)

I discovered that, somehow, my react-developer-tools extension from Chrome had been uninstalled (I'm not sure how). If I reinstall the extension in the browser, then this error does not occur and the react devtools are loaded. My understanding, though, is that this project allows us to install devtools without installing them in Chrome first, correct?

My system information:

Operating System: MacOS 10.15.6
React Devtools Version (Installed in Chrome): 4.8.2 (7/15/2020)
electron-devtools-installer Version: electron-devtools-installer@3.1.1
KotoriK commented 4 years ago

Same problem but with exit code 2

Error: Exited with code 2
    at ChildProcess.<anonymous> (C:\Users\Administrator.SVR-K\Documents\GitHub\rss-reader\node_modules\cross-unzip\index.js:38:21)
    at ChildProcess.emit (events.js:210:5)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)

System Info: Node v14.5 electron-devtools-installer@2.2.4 electron@8.4.1

CerratoA commented 3 years ago

Any solution for this issue? facing the code 2 error

sfilata commented 2 years ago

I get a code 2 error. Is there any solution?

ericpyle commented 2 years ago

I too get code 2 installing either of the two extensions:

const installExtensions = async () => {
  const installer = require('electron-devtools-installer');
  const forceDownload = !!process.env.UPGRADE_EXTENSIONS;
  const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'];

  return Promise.all(
    extensions.map(name => installer.default(installer[name], forceDownload))
  ).catch(console.log);
};

System Info

Node v16.13.2
electron-devtools-installer@npm:2.2.4
electron@npm:4.2.0

OS: Windows 11 (Version 10.0.22000 Build 22000)

UPDATE: Found a fix, see below (https://github.com/MarshallOfSound/electron-devtools-installer/issues/147#issuecomment-1035555581)

ericpyle commented 2 years ago

I fixed the error code 2 by explicitly letting yarn add the dev packages (like described here https://github.com/MarshallOfSound/electron-devtools-installer#install):

yarn add electron-devtools-installer -D
yarn add electron-react-devtools -D

[FWIW also upgraded to "electron-devtools-installer": "^3.2.0"]

They seem to be loading in my tabs now:

image