electron-devtools-installer
electron-devtools-installer copied to clipboard
React developer tools sometimes can't be loaded
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: [email protected]
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 [email protected] [email protected]
Any solution for this issue? facing the code 2 error
I get a code 2 error. Is there any solution?
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)
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:
