{"record":{"id":"93f390309fc864b2","repo":"thedotmack/claude-mem","slug":"bun-installation-completed-but-binary-not-found-p","errorCode":null,"errorMessage":"Bun installation completed but binary not found. Please restart your terminal and try again.","messagePattern":"Bun installation completed but binary not found\\. Please restart your terminal and try again\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/npx-cli/install/setup-runtime.ts","lineNumber":201,"sourceCode":"\n/** Run the platform-specific Bun installer, then confirm the binary is resolvable. */\nfunction runBunInstaller(): void {\n  if (IS_WINDOWS) {\n    execSync('powershell -c \"irm bun.sh/install.ps1 | iex\"', {\n      stdio: 'pipe',\n      timeout: INSTALL_TIMEOUT_MS,\n      shell: process.env.ComSpec ?? 'cmd.exe',\n    });\n  } else {\n    execSync('curl -fsSL https://bun.sh/install | bash', {\n      stdio: 'pipe',\n      timeout: INSTALL_TIMEOUT_MS,\n      shell: '/bin/bash',\n    });\n  }\n\n  if (!isBunInstalled()) {\n    throw new Error(\n      'Bun installation completed but binary not found. Please restart your terminal and try again.',\n    );\n  }\n}\n\nfunction installBun(): void {\n  try {\n    runBunInstaller();\n  } catch (error) {\n    const err = error instanceof Error ? error : new Error(String(error));\n    const manualInstructions = IS_WINDOWS\n      ? '  - winget install Oven-sh.Bun\\n  - Or: powershell -c \"irm bun.sh/install.ps1 | iex\"'\n      : '  - curl -fsSL https://bun.sh/install | bash\\n  - Or: brew install oven-sh/bun/bun';\n    throw new Error(\n      `Failed to install Bun. Please install manually:\\n${manualInstructions}\\nThen restart your terminal and try again.\\n` +\n        `Underlying error: ${describeExecError(err)}`,\n    );\n  }","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/npx-cli/install/setup-runtime.ts#L183-L219","documentation":"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.","triggerScenarios":"runBunInstaller completes its install command with exit code 0, but the post-check isBunInstalled() still returns false (binary not on PATH in this session).","commonSituations":"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.","solutions":["Open a new terminal (or source your shell profile) so PATH picks up the bun install location, then re-run.","Manually verify with 'which bun' / 'bun --version'; if absent, re-run the installer: curl -fsSL https://bun.sh/install | bash","Add the bun install directory (e.g. ~/.bun/bin) to your PATH manually."],"exampleFix":"// before\n$ claude-mem install   # throws after bun installer ran\n// after\n$ export PATH=\"$HOME/.bun/bin:$PATH\"\n$ which bun   # verify, then re-run installer","handlingStrategy":"fallback","validationCode":"import { execSync } from 'child_process';\nconst bunOnPath = (): boolean => { try { execSync('bun --version', { stdio: 'ignore' }); return true; } catch { return false; } };\nif (!bunOnPath()) await installBunManually();","typeGuard":"const hasBun = (p: string): boolean => existsSync(path.join(p, 'bun')) || existsSync(path.join(p, 'bun.exe'));","tryCatchPattern":"try {\n  await ensureBun();\n} catch (e) {\n  if (String(e).includes('binary not found')) {\n    console.error('Restart your terminal or add ~/.bun/bin to PATH, then retry.');\n  }\n}","preventionTips":["After installing bun, always open a fresh shell before re-running installers.","Add ~/.bun/bin to PATH in your shell profile proactively.","Verify with 'bun --version' before running installs that depend on it."],"tags":["bun","runtime","path"],"backgroundTag":"command-not-found","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}