4.4 KiB
name, description
| name | description |
|---|---|
| troubleshooting | Common issues and solutions for Claude Code installation, authentication, performance, and IDE integration. Use when user encounters errors, problems, or asks about debugging. |
Claude Code Troubleshooting
Installation Issues
Windows WSL Problems
OS/platform detection issues:
May require running npm config set os linux before installation.
Node.js path conflicts: WSL may use Windows npm instead of Linux versions.
- Check with
which npmandwhich node - Identify whether Linux or Windows paths are active
- nvm version conflicts can be resolved by ensuring nvm loads in shell configuration files
Recommended Solution: Use the native Claude Code installer as an alternative to npm:
curl -fsSL https://claude.ai/install.sh | bash
Linux/Mac Permission Errors
Native installer (recommended):
curl -fsSL https://claude.ai/install.sh | bash
Migration from npm: Migrate to local installation to avoid future permission issues:
claude migrate-installer
Authentication & Permissions
Reset Authentication
Run /logout and restart Claude Code to reset authentication.
For persistent issues, remove stored auth data:
rm -rf ~/.config/claude-code/auth.json
Manage Permissions
Use /permissions to allow specific tools without repeated approval prompts.
Performance Issues
Reduce Context Size
Use /compact regularly to reduce context size for large codebases.
Cancel Unresponsive Operations
Press Ctrl+C to cancel unresponsive operations.
Fix Search Functionality
Install system ripgrep to fix search functionality:
# macOS
brew install ripgrep
# Ubuntu/Debian
sudo apt install ripgrep
# Fedora
sudo dnf install ripgrep
IDE Integration Issues
JetBrains on WSL2
Firewall Issues: Configure Windows Firewall or enable mirrored networking mode.
Add to .wslconfig:
[wsl2]
networkingMode=mirrored
ESC Key Not Working (JetBrains)
Go to Settings → Tools → Terminal and disable "Move focus to the editor with Escape."
Or delete the "Switch focus to Editor" shortcut.
Markdown Issues
Missing Language Tags
Request language tags explicitly:
"Add appropriate language tags to all code blocks."
Automatic Formatting
Use formatting hooks for automatic post-processing validation.
Common Error Messages
"Command not found: claude"
Solution:
- Verify installation:
npm list -g @anthropic-ai/claude-code - Check PATH includes npm global bin directory
- Restart terminal
- Reinstall if necessary
"Authentication failed"
Solution:
- Run
/logoutthen/login - Verify API key is valid
- Check network connectivity
- Remove auth file:
rm -rf ~/.config/claude-code/auth.json
"Permission denied"
Solution:
- Check file permissions in project directory
- Verify user has write access
- Use
/permissionsto configure allowed operations - Check settings.json for overly restrictive deny rules
"Context too large"
Solution:
- Run
/compactto reduce context - Be more specific in queries
- Use subagents for isolated tasks
- Clear conversation with
/clear
"Rate limit exceeded"
Solution:
- Wait before retrying
- Check API usage limits
- Use
--max-turnsto limit operations - Implement delays in automation scripts
Getting Help
Built-in Diagnostics
Report bugs:
/bug
Check installation health:
/doctor
External Resources
- GitHub Issues: https://github.com/anthropics/claude-code/issues
- Documentation: https://docs.claude.com/en/docs/claude-code
- Community Support: Check GitHub Discussions
Debug Mode
Enable verbose logging:
claude --debug
claude --verbose
View detailed output:
claude --output-format json
Reinstallation
If all else fails, completely reinstall:
# Uninstall
npm uninstall -g @anthropic-ai/claude-code
# Clear cache
rm -rf ~/.config/claude-code
rm -rf ~/.claude
# Reinstall
npm install -g @anthropic-ai/claude-code
# Or use native installer
curl -fsSL https://claude.ai/install.sh | bash
Prevention Tips
- Keep Claude Code updated:
claude update - Regularly run
/compactfor large projects - Use specific queries rather than vague requests
- Configure permissions appropriately
- Monitor API usage and costs
- Use version control for important changes
- Enable checkpointing for easy recovery