thedotmack/claude-mem · error
bun install failed in
Error message
bun install failed in ${targetDir}
${describeExecError(err)} What it means
installPluginDependencies runs 'bun install' in the plugin target directory and, if it fails, rethrows with the target directory and the underlying exec error from describeExecError. This identifies exactly which directory's dependency install failed and why.
Solutions
- Ensure bun is installed and on PATH ('which bun'); run the runtime setup if not.
- Read the wrapped describeExecError output for the root cause and fix it (network, permissions, lockfile).
- Delete node_modules/bun.lock in the target directory and re-run install/repair.
- Re-run 'npx claude-mem install' or the repair command to retry.
Example fix
// before npx claude-mem install # 'bun install failed in /home/x/.claude-mem/plugin' // after cd /home/x/.claude-mem/plugin rm -rf node_modules bun.lock bun install # diagnose the real error, then re-run installer
Defensive patterns
Strategy: try-catch
Validate before calling
import { execSync } from 'child_process';
const bunAvailable = (() => { try { execSync('bun --version', { stdio: 'ignore' }); return true; } catch { return false; } })();
if (!bunAvailable) await ensureBun(); Try / catch
try {
await installPluginDependencies(dir);
} catch (e) {
if (/bun install failed in/.test(String(e))) {
console.error(e); // wrapped describeExecError shows registry/network cause
// retry after fixing bun PATH or network
}
} Prevention
- Install bun and confirm it is on PATH before running the installer.
- Ensure registry access (npm registry) isn't blocked by proxy/firewall.
- Keep the plugin target directory writable by the current user.
- Regenerate bun.lock instead of reusing one from another platform.
When it happens
Trigger: runBunInstall() throws during installPluginDependencies — bun missing from PATH, network failure fetching packages, lockfile mismatch, or script errors in the target dir.
Common situations: Bun not installed (ensureBun failed silently upstream), firewall blocking the npm registry, corrupted bun.lock, or insufficient write permissions in targetDir.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- Bun installation completed but binary not found. Please…
- Cannot lazy-spawn worker: Bun runtime not found on PATH
- claude-mem: bun --version probe failed:
- Dependency preflight found degraded optional setup
- [doctor] Failed to probe
AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17).
Data as JSON: /api/errors/caed17f3c50f1856.
Report an issue: GitHub.
Appendix: source
Thrown at src/npx-cli/install/setup-runtime.ts:481
// stall. execFile (not exec) passes bunPath as argv[0] with no shell, so a
// resolved path with spaces or shell metacharacters is never parsed.
const runBunInstall = (): Promise<void> =>
new Promise<void>((resolve, reject) => {
execFile(bunPath, ['install', '--frozen-lockfile', '--ignore-scripts'], {
cwd: targetDir,
timeout: INSTALL_TIMEOUT_MS,
maxBuffer: 16 * 1024 * 1024,
...(IS_WINDOWS ? { windowsHide: true } : {}),
}, (error, stdout, stderr) =>
// execFile errors don't carry stdio; attach so describeExecError can report it.
error ? reject(Object.assign(error, { stdout, stderr })) : resolve());
});
try {
await runBunInstall();
} catch (error) {
const err = error instanceof Error ? error : new Error(String(error));
throw new Error(`bun install failed in ${targetDir}\n${describeExecError(err)}`);
}
verifyCriticalModules(targetDir);
}
export function readInstallMarker(targetDir: string): MarkerSchema | null {
const path = markerPath(targetDir);
if (!existsSync(path)) return null;
const content = readFileSync(path, 'utf-8');
try {
const marker = JSON.parse(content);
if (marker && typeof marker === 'object' && typeof marker.version === 'string') {
return marker as MarkerSchema;
}
} catch {
// Legacy installs wrote only the version string as plain text.
}
View on GitHub (pinned to d8bc9755e7)