electron-devtools-installer
electron-devtools-installer copied to clipboard
Unable to install react-developer-tools (unzip exits with code 9 "not found" due to HTTP-204 trying to download the crx)
code (from electron-react-boilerplate):
const installer = require('electron-devtools-installer');
const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'];
// ... (some promise/catch/await magic) ...
extensions.map((name) => installer.default(installer[name], forceDownload))
output:
Error: Exited with code 9
at ChildProcess.<anonymous> (/home/kyra/dev/worst_story_engine/node_modules/cross-unzip/index.js:40:21)
at ChildProcess.emit (events.js:210:5)
at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
according to man unzip
, code 9 is:
the specified zipfiles were not found.
patched some logging into cross-unzip by hand, it's trying to run:
unzip -o ~/.config/Electron/extensions/fmkadmapgofadopljbjfkapdkoienihi.crx -d ~/.config/Electron/extensions/fmkadmapgofadopljbjfkapdkoienihi
looked at that file:
$ file ~/.config/Electron/extensions/fmkadmapgofadopljbjfkapdkoienihi.crx
~/.config/Electron/extensions/fmkadmapgofadopljbjfkapdkoienihi.crx: empty
tried to manually remove it, exact same issue again.
looks like somehow instead of e.g. 404ing or similar, the chrome servers just give you an empty file (or you somehow manage to drop the content instead of saving it, but i doubt that, utils.downloadFile
looks sane), thus not triggering your Failed to fetch
error.
Update:
peeled the url out of your code, curl
ed it manually to see:
$ curl -v https://clients2.google.com/service/update2/crx\?response\=redirect\&x\=id%3Dfmkadmapgofadopljbjfkapdkoienihi%26uc\&prodversion\=32
[omitting lots of ssl/connection stuff here that's unrelated]
* Connected to clients2.google.com (172.217.18.110) port 443 (#0)
* Using HTTP2, server supports multi-use
> GET /service/update2/crx?response=redirect&x=id%3Dfmkadmapgofadopljbjfkapdkoienihi%26uc&prodversion=32 HTTP/2
> Host: clients2.google.com
> user-agent: curl/7.72.0
> accept: */*
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 204
< content-security-policy: script-src 'report-sample' 'nonce-VQkaHQUCKKGpu5OepZ/IVg' 'unsafe-inline' 'strict-dynamic' https: http:;object-src 'none';base-uri 'self';report-uri https://csp.withgoogle.com/csp/clientupdate-aus/1
< cache-control: no-cache, no-store, max-age=0, must-revalidate
< pragma: no-cache
< expires: Mon, 01 Jan 1990 00:00:00 GMT
< date: Sun, 27 Sep 2020 08:36:37 GMT
< server: GSE
< alt-svc: h3-Q050=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-27=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
<
* Connection #0 to host clients2.google.com left intact
so yeah, getting a nice HTTP/2 204
(no content) with empty response, which you're not catching in downloadFile
, if i had to take a wild guess i'd say google changed the URL and/or extension id (though https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi still seems valid).
note it actually did install the redux tools, so it just seems to be something about the react-devtools that's wrong
I also experience this. Probably the culprit is cross-zip
package. It's only a wild guess though. Need to check and confirm.
I ended up using https://www.electronjs.org/docs/api/session#sesloadextensionpath and it worked fine. Great package anyway 👍
I believe you just need to upgrade to version 3.1.1 which suppports crx version 3 downloads. It was fixed here: #140
@esiegel Thanks! Update to 3.1.1 fixed the issue for me.