A comprehensive solution to fix Claude Code installation issues on macOS, specifically targeting React error #327 and related Node.js/npm conflicts.
Run the master script to automatically diagnose and fix your Claude Code installation:
./fix_claude_master.sh
This tool addresses common Claude Code installation issues including:
- React Error #327: Minified React error during migration
- Node.js Version Conflicts: Non-LTS versions causing compatibility issues
- npm Permission Issues: Global installation permission conflicts
- Multiple Installation Conflicts: Homebrew, nvm, system Node conflicts
- Corrupted Cache: npm cache corruption causing installation failures
fix_claude_master.sh
- Main orchestration script that runs everythingscripts/diagnose.sh
- Comprehensive system diagnosticsscripts/fix_claude.sh
- Complete fix implementationscripts/claude_docker.sh
- Docker-based alternative solutionscripts/rollback.sh
- Safety rollback for changesscripts/cleanup.sh
- Clean up working directories
- 🔍 Comprehensive Diagnostics: Checks Node.js, npm, nvm, Homebrew, permissions
- 🔧 Automated Fixes: Handles permission issues, version conflicts, cache problems
- 🐳 Docker Alternative: Containerized solution if native fix fails
- 📦 Safe Backups: Backs up configurations before making changes
- 🔄 Rollback Support: Can undo changes if needed
- 🧹 Clean Workspace: Self-contained working directory
claude /migrate-installer
✢ Removing global npm installation
file:///Users/spaceplushy/node_modules/@anthropic-ai/claude-code/cli.js:65
Error: Minified React error #327; visit https://reactjs.org/docs/error-decoder.html?invariant=327
at PW (file:///Users/spaceplushy/node_modules/@anthropic-ai/claude-code/cli.js:67:34915)
Node.js v22.16.0
- Node.js v22.16.0 (non-LTS) compatibility issues
- Partial installation state from failed migration
- npm permission conflicts
- Corrupted npm cache
- Multiple Node.js version managers interfering
- OS: macOS
- Shell: zsh (or bash)
- Permissions: User account access (no sudo required for most operations)
- Scans for all Node.js installations (system, Homebrew, nvm, fnm)
- Checks npm configurations and permissions
- Locates all Claude Code installations
- Identifies version conflicts and permission issues
- Generates detailed diagnostic report
- Backup: Saves existing Claude configurations
- Cleanup: Removes corrupted installations and cleans cache
- Permissions: Sets up proper npm global directory
- Node.js: Installs/switches to LTS version via nvm
- Reinstall: Fresh Claude Code installation
- Verify: Tests installation and functionality
When running, creates a self-contained workspace:
claude-fix/
├── scripts/ # All fix scripts
├── logs/ # Execution logs
├── backups/ # Configuration backups
└── reports/ # Diagnostic reports
- Non-destructive: Backs up all configurations before changes
- Confirmation prompts: Asks before destructive operations
- Detailed logging: Records all actions for troubleshooting
- Rollback capability: Can undo changes if needed
- Self-contained: All operations within working directory
The fix is successful when:
- ✅
claude --version
returns version without errors - ✅
which claude
shows a single, accessible path - ✅ No React errors occur during operation
- ✅ Claude commands work normally
If the native fix fails, use the Docker solution:
cd scripts
./claude_docker.sh build
./claude_docker.sh shell
If you need to undo changes:
cd scripts
./rollback.sh
Remove the working directory when done:
cd scripts
./cleanup.sh
All operations are logged to:
logs/fix_claude.log
- Fix script execution loglogs/diagnostic_errors.log
- Diagnostic error detailsreports/diagnostic_report.txt
- Complete system analysis
This tool was created to solve a specific Claude Code installation issue but can be extended for other Node.js/npm related problems.
MIT License - feel free to use and modify as needed.
- Check the logs in
logs/fix_claude.log
- Review the diagnostic report in
reports/diagnostic_report.txt
- Try the Docker solution as an alternative
- Use the rollback script to undo changes
- Permission denied: Ensure you have write access to your home directory
- nvm not found: The script will install nvm automatically
- Docker not available: Install Docker Desktop for the containerized solution
- "Config install method: unknown" warning: This is a cosmetic warning that occurs when Claude is running locally but the config database hasn't been updated. It doesn't affect functionality. To resolve: run
claude migrate-installer
or ignore the warning.
Status: ✅ Successfully tested and verified on macOS with Node.js v22.16.0