oven-sh/bun · error · Error

Your package manager doesn't seem to support bun. To use bun

Error message

Your package manager doesn't seem to support bun. To use bun, install using the following command: ${installScript}

What it means

optimizeBun() finishes the npm install by renaming the downloaded binary into <pkg>/bin/bun.exe and hard-linking bunx.exe next to it. If the rename or link fails (locked file, EPERM, EBUSY, cross-device link), it concludes the environment cannot host bun via npm and points you at the standalone install script.

Source

Thrown at packages/bun-release/src/npm/install.ts:138

          }
        }
      }
      offset += (size + 511) & ~511;
    }
  }
}

export function optimizeBun(path: string): void {
  const installScript =
    os === "win32" ? 'powershell -c "irm bun.sh/install.ps1 | iex"' : "curl -fsSL https://bun.com/install | bash";
  try {
    rename(path, join(__dirname, "bin", "bun.exe"));
    link(join(__dirname, "bin", "bun.exe"), join(__dirname, "bin", "bunx.exe"));
    return;
  } catch (error) {
    debug("optimizeBun failed", error);
  }
  throw new Error(
    `Your package manager doesn't seem to support bun. To use bun, install using the following command: ${installScript}`,
  );
}

View on GitHub (pinned to 8c5296ac45)

Solutions

  1. Stop all running bun/bunx processes (taskkill /IM bun.exe /F) and reinstall
  2. Exclude the npm global prefix from antivirus/sync tools, or move the prefix to a plain local path
  3. Run the terminal as administrator if __dirname is not writable
  4. Skip the npm route: powershell -c "irm bun.sh/install.ps1 | iex"

Example fix

# before
npm i -g bun   # bun.exe still running -> rename/link fails

# after
taskkill /IM bun.exe /F 2>nul & taskkill /IM bunx.exe /F 2>nul
npm i -g bun
# or: powershell -c "irm bun.sh/install.ps1 | iex"
Defensive patterns

Strategy: fallback

Validate before calling

// before npm-installing/upgrading bun on Windows, make sure nothing holds the binary
import { spawnSync } from 'node:child_process';
const { stdout } = spawnSync('tasklist', ['/FI', 'IMAGENAME eq bun.exe'], { encoding: 'utf8' });
if (!stdout.includes('INFO: No tasks')) throw new Error('bun.exe is running — stop it before upgrading');

Prevention

When it happens

Trigger: A running bun.exe/bunx.exe process locking the file during upgrade; antivirus or sync tools (OneDrive/Dropbox) holding the directory; installing into a network or non-NTFS filesystem where hard-link creation fails; insufficient write permission on __dirname.

Common situations: 'npm i -g bun' on Windows while a bun dev server is still running; corporate endpoint protection quarantining/scanning fresh executables; global npm prefixes on roaming profiles.

Related errors


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/4d2ac99a42843095. Report an issue: GitHub.