oven-sh/bun · error · bun_install::Error

No global directory found

Error message

No global directory found

What it means

Variant of the install Error enum whose message is human text: `bun add -g` (or any global operation) could not locate a global install directory — neither an explicitly configured one nor a discoverable default on this system. The installer has no prefix under which to place global packages, so it aborts.

Solutions

  1. Set BUN_INSTALL to a writable directory (e.g. export BUN_INSTALL=$HOME/.bun)
  2. Ensure the directory exists and is writable; create it if needed
  3. Avoid running global installs where $HOME is unset or read-only
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/install/error.rs:73 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at src/install/error.rs:73

    #[error("LockfileResolveFailed")]
    LockfileResolveFailed,
    #[error("DistTagNotFound")]
    DistTagNotFound,
    #[error("NoMatchingVersion")]
    NoMatchingVersion,
    #[error("TooRecentVersion")]
    TooRecentVersion,
    #[error("MissingPackageJSON")]
    MissingPackageJSON,
    #[error("InstallFailed")]
    InstallFailed,
    #[error("HTTPError")]
    HTTPError,
    #[error("Failed")]
    Failed,
    #[error("UnrecognizedDependencyFormat")]
    UnrecognizedDependencyFormat,
    #[error("No global directory found")]
    NoGlobalDirectoryFound,
    #[error("InvalidPackageID")]
    InvalidPackageID,
    #[error("PartialInstallFailed")]
    PartialInstallFailed,
    #[error("NoPackagesInstalled")]
    NoPackagesInstalled,
    #[error("SecurityScannerInWorkspace")]
    SecurityScannerInWorkspace,
    #[error("SecurityScannerRetryFailed")]
    SecurityScannerRetryFailed,
    #[error("IPCPipeFailed")]
    IPCPipeFailed,
    #[error("JSONPipeWriterFailed")]
    JSONPipeWriterFailed,
    #[error("ProcessWatchFailed")]
    ProcessWatchFailed,
    #[error("SecurityScannerProcessFailedWithoutExitStatus")]

View on GitHub (pinned to 8c5296ac45)