Claude Code troubleshooting
Solutions for common issues with Claude Code installation and usage.
Common installation issues
Linux permission issues
When installing Claude Code with npm, you may encounter permission errors if your npm global prefix is not user writable (eg. /usr
, or /use/local
).
Recommended solution: Create a user-writable npm prefix
The safest approach is to configure npm to use a directory within your home folder:
This solution is recommended because it:
- Avoids modifying system directory permissions
- Creates a clean, dedicated location for your global npm packages
- Follows security best practices
System Recovery: If you have run commands that change ownership and permissions of system files or similar
If you’ve already run a command that changed system directory permissions (such as sudo chown -R $USER:$(id -gn) /usr && sudo chmod -R u+w /usr
) and your system is now broken (for example, if you see sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
), you’ll need to perform recovery steps.
Ubuntu/Debian Recovery Method:
-
While rebooting, hold SHIFT to access the GRUB menu
-
Select “Advanced options for Ubuntu/Debian”
-
Choose the recovery mode option
-
Select “Drop to root shell prompt”
-
Remount the filesystem as writable:
-
Fix permissions:
-
Reinstall affected packages (optional but recommended):
-
Reboot:
Alternative Live USB Recovery Method:
If the recovery mode doesn’t work, you can use a live USB:
-
Boot from a live USB (Ubuntu, Debian, or any Linux distribution)
-
Find your system partition:
-
Mount your system partition:
-
If you have a separate boot partition, mount it too:
-
Chroot into your system:
-
Follow steps 6-8 from the Ubuntu/Debian recovery method above
After restoring your system, follow the recommended solution above to set up a user-writable npm prefix.
Auto-updater issues
If Claude Code can’t update automatically, it may be due to permission issues with your npm global prefix directory. Follow the recommended solution above to fix this.
If you prefer to disable the auto-updater instead, you can use:
Permissions and authentication
Repeated permission prompts
If you find yourself repeatedly approving the same commands, you can allow specific tools to run without approval:
Authentication issues
If you’re experiencing authentication problems:
- Run
/logout
to sign out completely - Close Claude Code
- Restart with
claude
and complete the authentication process again
If problems persist, try:
This removes your stored authentication information and forces a clean login.
Performance and stability
High CPU or memory usage
Claude Code is designed to work with most development environments, but may consume significant resources when processing large codebases. If you’re experiencing performance issues:
- Use
/compact
regularly to reduce context size - Close and restart Claude Code between major tasks
- Consider adding large build directories to your
.gitignore
and.claudeignore
files
Command hangs or freezes
If Claude Code seems unresponsive:
- Press Ctrl+C to attempt to cancel the current operation
- If unresponsive, you may need to close the terminal and restart
- For persistent issues, run Claude with verbose logging:
claude --verbose
Getting more help
If you’re experiencing issues not covered here:
- Use the
/bug
command within Claude Code to report problems directly to Anthropic - Check the GitHub repository for known issues
- Run
/doctor
to check the health of your Claude Code installation
Was this page helpful?