thedotmack/claude-mem · error

Bun installation completed but binary not found. Please…

Error message

Bun installation completed but binary not found. Please restart your terminal and try again.

What it means

After running the Bun installer script, the code re-checks isBunInstalled() and throws if the binary still cannot be found on PATH. This catches installers that exit without actually placing the bun binary where the current shell can see it.

Solutions

  1. Open a new terminal (or source your shell profile) so PATH picks up the bun install location, then re-run.
  2. Manually verify with 'which bun' / 'bun --version'; if absent, re-run the installer: curl -fsSL https://bun.sh/install | bash
  3. Add the bun install directory (e.g. ~/.bun/bin) to your PATH manually.

Example fix

// before
$ claude-mem install   # throws after bun installer ran
// after
$ export PATH="$HOME/.bun/bin:$PATH"
$ which bun   # verify, then re-run installer
Defensive patterns

Strategy: fallback

Validate before calling

import { execSync } from 'child_process';
const bunOnPath = (): boolean => { try { execSync('bun --version', { stdio: 'ignore' }); return true; } catch { return false; } };
if (!bunOnPath()) await installBunManually();

Type guard

const hasBun = (p: string): boolean => existsSync(path.join(p, 'bun')) || existsSync(path.join(p, 'bun.exe'));

Try / catch

try {
  await ensureBun();
} catch (e) {
  if (String(e).includes('binary not found')) {
    console.error('Restart your terminal or add ~/.bun/bin to PATH, then retry.');
  }
}

Prevention

When it happens

Trigger: runBunInstaller completes its install command with exit code 0, but the post-check isBunInstalled() still returns false (binary not on PATH in this session).

Common situations: Installer wrote bun to a directory not on the current PATH, fresh shell/profile changes not picked up, or a partially-failed install script that exited 0 anyway.

Related errors


AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17). Data as JSON: /api/errors/93f390309fc864b2. Report an issue: GitHub.

Appendix: source

Thrown at src/npx-cli/install/setup-runtime.ts:201

/** Run the platform-specific Bun installer, then confirm the binary is resolvable. */
function runBunInstaller(): void {
  if (IS_WINDOWS) {
    execSync('powershell -c "irm bun.sh/install.ps1 | iex"', {
      stdio: 'pipe',
      timeout: INSTALL_TIMEOUT_MS,
      shell: process.env.ComSpec ?? 'cmd.exe',
    });
  } else {
    execSync('curl -fsSL https://bun.sh/install | bash', {
      stdio: 'pipe',
      timeout: INSTALL_TIMEOUT_MS,
      shell: '/bin/bash',
    });
  }

  if (!isBunInstalled()) {
    throw new Error(
      'Bun installation completed but binary not found. Please restart your terminal and try again.',
    );
  }
}

function installBun(): void {
  try {
    runBunInstaller();
  } catch (error) {
    const err = error instanceof Error ? error : new Error(String(error));
    const manualInstructions = IS_WINDOWS
      ? '  - winget install Oven-sh.Bun\n  - Or: powershell -c "irm bun.sh/install.ps1 | iex"'
      : '  - curl -fsSL https://bun.sh/install | bash\n  - Or: brew install oven-sh/bun/bun';
    throw new Error(
      `Failed to install Bun. Please install manually:\n${manualInstructions}\nThen restart your terminal and try again.\n` +
        `Underlying error: ${describeExecError(err)}`,
    );
  }

View on GitHub (pinned to d8bc9755e7)