thedotmack/claude-mem · warning
Could not update ${configFile}: ${error instanceof Error ? e
Error message
Could not update ${configFile}: ${error instanceof Error ? error.message : String(error)} What it means
A log.warn from the installer's PATH setup: writeFileSync of the appended PATH export block ('# Added by claude-mem installer…') to the shell config failed. The installer immediately prints remediation — the exact `echo '<export line>' >> <configFile>` command — and returns, leaving PATH unmodified in the file. The in-process PATH env var is not updated on this failure path.
Source
Thrown at src/npx-cli/commands/install.ts:544
} else {
try {
mkdirSync(dirname(configFile), { recursive: true });
} catch {
// Best-effort directory creation.
}
}
if (existing.includes(claudeBinDir) || existing.includes(binPathLiteral)) {
log.info(`Claude Code PATH already configured in ${configFile}`);
} else {
try {
const trailing = existing.length === 0 || existing.endsWith('\n') ? '' : '\n';
const block = `${trailing}\n# Added by claude-mem installer for Claude Code\n${exportLine}\n`;
writeFileSync(configFile, existing + block, 'utf-8');
log.success(`Added Claude Code to PATH in ${configFile}`);
} catch (error: unknown) {
// [ANTI-PATTERN IGNORED]: the failure is already surfaced to the user via the interactive-aware log.warn wrapper below (p.log.warn in a TTY, console.warn otherwise), together with the manual remediation command.
log.warn(`Could not update ${configFile}: ${error instanceof Error ? error.message : String(error)}`);
log.info(`Run manually: echo '${exportLine}' >> ${configFile}`);
return;
}
}
process.env.PATH = `${claudeBinDir}:${currentPath}`;
}
async function installClaudeCode(): Promise<boolean> {
const command = IS_WINDOWS
? 'powershell -ExecutionPolicy ByPass -c "irm https://claude.ai/install.ps1 | iex"'
: 'curl -fsSL https://claude.ai/install.sh | bash';
const installShell = IS_WINDOWS ? (process.env.ComSpec ?? 'cmd.exe') : '/bin/bash';
const spinner = isInteractive ? p.spinner() : null;
spinner?.start('Installing Claude Code (this can take a few minutes — downloading the native build)…');
return new Promise<boolean>((resolve) => {View on GitHub (pinned to e2d1df569a)
Solutions
- Run the exact command the installer printed: echo '<export line>' >> ~/.zshrc (it appears in the warn output)
- Or restore writability: chmod u+w ~/.zshrc (and chown if needed), then re-run install
- Open a new shell or source the config afterwards so PATH picks up ~/.local/bin
Example fix
# before
log.warn("Could not update /home/user/.zshrc: EACCES")
# after (manual remediation printed by the installer)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc Defensive patterns
Strategy: fallback
Validate before calling
import { accessSync, constants } from 'node:fs';
function configWritable(file: string): boolean {
try { accessSync(file, constants.W_OK); return true; } catch { return false; }
} Prevention
- Apply the exact manual echo command the installer prints on this failure
- Keep shell configs owner-writable; chmod u+w if a dotfile manager locked them
- Open a new shell (or source the config) after manual edits so PATH updates take effect
When it happens
Trigger: Shell config is read-only (chmod a-w), on a read-only or full filesystem, root-owned, or locked by another writer; sandboxed installers (npx in a restricted context) blocked from writing dotfiles.
Common situations: Dotfiles managed by tools that mark configs read-only intentionally; disk-full conditions; corporate hardening that makes $HOME dotfiles immutable; running the installer with a HOME pointing at a mounted read-only volume.
Related errors
- Could not read ${configFile}: ${error instanceof Error ? err
- [ide-detection] Failed to read VS Code extensions directory:
- Could not auto-apply PATH setup: ${error instanceof Error ?
- Corrupt JSON in ${GEMINI_SETTINGS_PATH}, refusing to overwri
- MCP server script not found
AI-assisted analysis of thedotmack/claude-mem@e2d1df569a (2026-08-20).
Data as JSON: /api/errors/ab0f3ed423e3f089.
Report an issue: GitHub.