Electron "Failed to download" the Electron binary in CI
electron's postinstall downloads a large platform-specific zip from GitHub releases. In CI a network hiccup, rate limit, or blocked mirror makes that fetch fail and the install aborts.
What this error means
npm install fails inside the electron postinstall with "Error: Failed to download" or "RequestError: connect ETIMEDOUT", referencing a github.com release URL.
Error: Failed to download electron-v31.0.0-linux-x64.zip
RequestError: connect ETIMEDOUT 140.82.121.4:443
at ClientRequest.<anonymous> (.../got/dist/source/core/index.js)Common causes
Transient network failure or GitHub rate limit
The default download host is GitHub releases; a momentary timeout or an anonymous rate limit drops the transfer mid-download.
A blocked or slow mirror
A corporate proxy or a misconfigured ELECTRON_MIRROR cannot serve the zip, so got retries and then fails.
How to fix it
Cache and reuse the Electron download
Persist the electron download cache across runs so the binary is fetched once, not on every job.
- uses: actions/cache@v4
with:
path: ~/.cache/electron
key: electron-${{ hashFiles('package-lock.json') }}Point at a reliable mirror
Set ELECTRON_MIRROR to a fast, reachable host when GitHub is rate limited or blocked.
env:
ELECTRON_MIRROR: https://npmmirror.com/mirrors/electron/How to prevent it
- Cache
~/.cache/electronkeyed on the lockfile. - Configure a stable
ELECTRON_MIRRORfor your region. - Authenticate GitHub requests to avoid anonymous rate limits.