oven-sh/bun · error · Error
Failed to install package "${module}"
Error message
Failed to install package "${module}" What it means
importBun() iterates every supported platform package; each requireBun() resolves the downloaded binary and sanity-checks it by spawning '<exe> --version'. If every attempt throws (resolve failure, non-zero exit, spawn error) the installer gives up with this final error naming the release module it tried to install. The per-attempt causes are only visible via the debug log.
Source
Thrown at packages/bun-release/src/npm/install.ts:25
import { abi, arch, os, supportedPlatforms } from "../platform";
import { spawn } from "../spawn";
declare const version: string;
declare const module: string;
declare const owner: string;
export async function importBun(): Promise<string> {
if (!supportedPlatforms.length) {
throw new Error(`Unsupported platform: ${os} ${arch} ${abi || ""}`);
}
for (const platform of supportedPlatforms) {
try {
return await requireBun(platform);
} catch (error) {
debug("requireBun failed", error);
}
}
throw new Error(`Failed to install package "${module}"`);
}
async function requireBun(platform: Platform): Promise<string> {
const module = `${owner}/${platform.bin}`;
function resolveBun() {
const exe = require.resolve(join(module, platform.exe));
const { exitCode, stderr, stdout } = spawn(exe, ["--version"]);
if (exitCode === 0) {
return exe;
}
throw new Error(stderr || stdout);
}
try {
return resolveBun();
} catch (cause) {
debug("resolveBun failed", cause);
error(
`Failed to find package "${module}".`,View on GitHub (pinned to 8c5296ac45)
Solutions
- Check network reachability of registry.npmjs.org and proxy env vars (HTTPS_PROXY/HTTP_PROXY), then retry the install
- Run the downloaded binary manually to see the real spawn error: node_modules/<platform-pkg>/bin/bun --version
- If glibc is too old, use the Docker image or a musl-hosting equivalent
- Fall back to the standalone install script, which does not depend on the npm postinstall path
Example fix
# before npm i -g bun # -> Failed to install package "bun" # after npm cache clean --force && npm i -g bun # retry after clearing cache ./node_modules/bun-linux-x64/bin/bun --version # surface the real spawn error curl -fsSL https://bun.sh/install | bash # fallback installer
Defensive patterns
Strategy: retry
Validate before calling
// pre-flight: can we reach the registry and execute downloaded binaries?
const res = await fetch('https://registry.npmjs.org/-/ping');
if (!res.ok) throw new Error(`registry unreachable (${res.status}) — fix proxy before install`); Try / catch
let lastError: unknown;
for (let attempt = 0; attempt < 3; attempt++) {
try {
exePath = await importBun();
break;
} catch (err) {
lastError = err;
}
}
if (!exePath) throw lastError; Prevention
- Verify registry/proxy env before scripted installs in CI
- Test-exec the downloaded binary once to surface exec-format/glibc errors early
- Keep the standalone install script as the documented fallback
When it happens
Trigger: The downloaded bun binary fails to execute (exec format error under wrong emulation, glibc too old, missing interp), extraction or resolution failed, or the download step never completed because registry.npmjs.org was unreachable through a proxy/firewall.
Common situations: Corporate proxies or registry mirrors (Artifactory/Nexus) blocking or mangling tarballs; old glibc distros (CentOS 7) where bun will not start; qemu-user containers; transient npm registry outages during postinstall.
Related errors
- Unsupported platform: ${os} ${arch} ${abi || ""}
- Invalid gzip data
- page-cache eviction failed for ${path}; results would be war
- not called
- Your package manager doesn't seem to support bun. To use bun
AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16).
Data as JSON: /api/errors/c2d17313013f55b0.
Report an issue: GitHub.