🔥 Fix Claude Code Errors
Click any error for the instant fix. All commands are copy-paste ready.
▸ bash: claude: command not found
Cause
The Claude Code binary is not in your system PATH after installation.
Fix Steps
- Add ~/.local/bin to your PATH:
- echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
- source ~/.zshrc
- Verify: claude --version
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc ▸ EACCES: permission denied, mkdir '/usr/local/lib/node_modules'
Cause
npm global install requires write access to system directories. Never use sudo.
Fix Steps
- Use the native installer instead of npm:
- curl -fsSL https://claude.ai/install.sh | bash
- Or fix npm permissions: npm config set prefix ~/.npm-global
curl -fsSL https://claude.ai/install.sh | bash ▸ Error: Authentication failed. Please run claude login.
Cause
OAuth token expired or you haven't authenticated yet.
Fix Steps
- Re-authenticate:
- claude login
- Follow the browser prompt to complete OAuth.
- If using API key: export ANTHROPIC_API_KEY=your-key
claude login ▸ Error 429: Too Many Requests — rate limit exceeded
Cause
You've hit the usage limit for your current plan.
Fix Steps
- Wait a few minutes and retry.
- Check your usage: /cost in Claude Code.
- Use /compact to reduce token consumption.
- Upgrade plan at claude.ai/pricing for higher limits.
/cost ▸ Error: connect ECONNREFUSED — unable to reach api.anthropic.com
Cause
Network issue — firewall, proxy, or DNS blocking the connection.
Fix Steps
- Check internet: curl -I https://api.anthropic.com
- If behind proxy: export HTTPS_PROXY=http://proxy:port
- Check firewall allows HTTPS to api.anthropic.com.
- Try: claude doctor
curl -I https://api.anthropic.com ▸ Error: Node.js 18+ required. Current version: v16.x.x
Cause
npm installation requires Node.js 18 or later. Native install does NOT need Node.
Fix Steps
- Best fix — use the native installer (no Node needed):
- curl -fsSL https://claude.ai/install.sh | bash
- Or upgrade Node: nvm install 22 && nvm use 22
curl -fsSL https://claude.ai/install.sh | bash ▸ Error: WSL not detected / WSL bash not found
Cause
Claude Code on Windows needs WSL or Git Bash.
Fix Steps
- Install WSL: wsl --install
- Restart computer after WSL install.
- Open WSL terminal and install Claude Code:
- curl -fsSL https://claude.ai/install.sh | bash
wsl --install ▸ Error: Request timed out after 30000ms
Cause
The API request took too long. Could be network or server load.
Fix Steps
- Retry the command.
- Check Anthropic status: status.anthropic.com
- If on slow network, increase timeout or use stable channel.
- Run claude doctor to diagnose.
claude doctor ▸ Error: libstdc++.so.6: cannot open shared object file
Cause
Alpine Linux / musl-based systems need additional dependencies.
Fix Steps
- Install required packages:
- apk add libgcc libstdc++ ripgrep
- Set environment variable:
- export USE_BUILTIN_RIPGREP=0
- Then install Claude Code normally.
apk add libgcc libstdc++ ripgrep && export USE_BUILTIN_RIPGREP=0 ▸ Error: ENOSPC — no space left on device
Cause
Disk is full. Claude Code needs space for the binary and cache.
Fix Steps
- Check disk usage: df -h
- Clear npm cache: npm cache clean --force
- Remove old versions: rm -rf ~/.local/share/claude
- Reinstall Claude Code.
df -h && npm cache clean --force ▸ Error: unable to verify the first certificate (SSL_ERROR)
Cause
Corporate proxy or VPN intercepting HTTPS traffic.
Fix Steps
- If behind corporate proxy, set NODE_EXTRA_CA_CERTS:
- export NODE_EXTRA_CA_CERTS=/path/to/corporate-ca.pem
- Or try: export NODE_TLS_REJECT_UNAUTHORIZED=0 (temporary, insecure)
- Contact IT for the corporate CA certificate.
export NODE_EXTRA_CA_CERTS=/path/to/corporate-ca.pem