Bun install registry network / connection error in CI
Bun opened a connection to the registry but the download timed out or the connection dropped mid-transfer. This is typically transient network flakiness rather than a bad request or bad auth.
What this error means
bun install fails with a connection or timeout error against the registry host, and a retry on the same job or a re-run often succeeds.
bun install
error: ConnectionRefused downloading https://registry.npmjs.org/react
error: Failed to installCommon causes
Transient network slowness or a dropped connection
A slow mirror, momentary packet loss, or a large tarball makes the download stall or the socket drop before completion.
A flaky or rate-limited registry mirror
The configured registry returns intermittent errors or throttles the runner, so some downloads fail while others succeed.
How to fix it
Retry the install and cache the store
- Re-run the install; transient drops usually clear on retry.
- Cache
~/.bun/install/cacheso already-downloaded packages are reused. - Point at a reliable registry mirror for your region.
- uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: bun-${{ hashFiles('bun.lockb') }}
- run: bun install --frozen-lockfileSet the registry explicitly
Pin a known-good registry in bunfig.toml so Bun does not fall back to a flaky mirror.
[install]
registry = "https://registry.npmjs.org/"How to prevent it
- Cache the Bun install cache to avoid re-downloading on flakes.
- Pin a reliable registry in bunfig.toml.
- Retry install on transient network errors.