fix-peer-deps
A modern CLI tool to analyze and fix peer dependency issues across multiple package managers (npm, yarn, pnpm, bun).

Description
fix-peer-deps
is a powerful command-line tool designed to simplify the often complex task of managing peer dependencies in JavaScript/Node.js projects. It addresses common challenges developers face when working with packages that have peer dependency requirements:
- 🔍 Intelligent Detection: Automatically identifies peer dependency conflicts and missing requirements
- 🎯 Smart Resolution: Suggests the most compatible versions based on your project's constraints
- 🚀 Universal Compatibility: Works across major package managers (npm, yarn, pnpm, bun)
- 💡 Developer-Friendly: Provides clear, actionable suggestions with copy-paste ready commands
- 🎨 Modern Interface: Features a beautiful CLI interface with progress tracking and visual feedback
Why Use fix-peer-deps?
- Save Time: Quickly identify and resolve peer dependency issues that could take hours to debug manually
- Prevent Errors: Catch peer dependency conflicts before they cause runtime issues
- Cross-Platform: Works with any package manager, making it versatile for different project setups
- Clear Guidance: Get straightforward solutions instead of cryptic error messages
- Modern Experience: Enjoy a beautiful, interactive terminal interface while fixing dependencies
How It Works
The tool performs a deep analysis of your project's dependency tree by:
- Scanning your project's package manager and lock files
- Analyzing direct and transitive dependencies
- Identifying peer dependency conflicts and missing requirements
- Generating specific, actionable solutions
- Providing clear commands to resolve each issue
Features
- 🎯 Accurately detects and categorizes peer dependency issues
- 🚦 Distinguishes between critical and optional peer dependencies
- 🔄 Supports modern package managers (npm, yarn 4.x, pnpm, bun)
- 🎨 Beautiful CLI interface with progress indicators
- 🧪 Intelligent filtering of development-only dependencies
- ⚡ Automatic fix mode with
--fix
option
Installation
Method 1: Run Directly (Recommended for one-time use)
npx fix-peer-deps
yarn dlx fix-peer-deps
pnpm dlx fix-peer-deps
bunx fix-peer-deps
Method 2: Global Installation
If you frequently work with multiple Node.js projects, you can install the package globally:
npm install -g fix-peer-deps
yarn global add fix-peer-deps
pnpm add -g fix-peer-deps
bun add -g fix-peer-deps
After global installation:
-
Verify the installation:
fix-peer-deps --version
-
You can now run the tool from any directory:
cd /path/to/your/project
fix-peer-deps
Usage
Basic Usage
-
Navigate to your project directory:
cd /path/to/your/project
-
Run the analysis:
fix-peer-deps
-
Review the output:
- Critical issues that need attention
- Optional dependencies that might improve development
- Suggested commands to fix issues
-
Fix issues either:
- Manually using the suggested commands, or
- Automatically using the
--fix
option
Command Options
fix-peer-deps
fix-peer-deps --fix
fix-peer-deps --help
fix-peer-deps -v
fix-peer-deps --version
Available Commands
fix-peer-deps
: Analyzes your project and provides suggestionsfix-peer-deps --fix
: Automatically installs missing peer dependenciesfix-peer-deps -h, --help
: Shows help informationfix-peer-deps -v, --version
: Shows the current version
The tool will:
- Detect your package manager
- Analyze your dependencies
- Categorize issues by severity
- Provide specific commands to fix critical issues
- List optional dependencies that might improve your development experience
Understanding the Output
The tool categorizes peer dependency issues into two types:
Critical Issues (🚨)
- Missing or incompatible dependencies that are required for packages to function
- These should typically be resolved to ensure proper functionality
- Can be automatically fixed using the
--fix
option
Optional Issues (⚠️)
- Development dependencies that might enhance your development experience
- Type definitions (@types/*)
- Optional peer dependencies
- Development tool integrations
Example Output
When you run fix-peer-deps
, you'll see output similar to this:
🔍 Detecting package manager... npm
📦 Analyzing dependencies...
████████████████████████████████████ 100%
📋 Found Issues:
• 2 critical issues
• 1 optional issue
🚨 Critical Issues:
react-dom requires react@^18.2.0
Current: 17.0.2
@mui/material requires react@^17.0.0 || ^18.0.0
Current: missing
⚠️ Optional Issues:
@types/react optionally requires react@*
Current: 17.0.2
📝 Suggested Actions:
Run the following commands to resolve critical issues:
npm install react@18.2.0
npm install @mui/material
💡 Tips:
• Use --fix to automatically resolve critical issues
• Optional issues can be resolved manually if needed
This output shows:
- Package manager detection
- Progress of dependency analysis
- Summary of found issues
- Detailed breakdown of critical and optional issues
- Specific commands to resolve problems
- Helpful tips for using the tool
Common Use Cases
-
Starting a New Project:
cd my-new-project
npm init -y
npm install some-package
fix-peer-deps
-
Fixing Dependency Issues:
fix-peer-deps --fix
-
Auditing Dependencies:
fix-peer-deps
-
CI/CD Integration:
fix-peer-deps || exit 1
Configuration
The tool automatically detects your package manager based on:
- The
packageManager
field in package.json - Lock files present in your project
- Defaults to npm if no specific manager is detected
Supported Package Managers
- npm (all versions)
- yarn (including yarn 4.x)
- pnpm
- bun
Troubleshooting
Common Issues
-
Command Not Found
npm install -g fix-peer-deps
-
Permission Errors
sudo npm install -g fix-peer-deps
-
Package Manager Detection Issues
ls package.json
Error Messages
- "No package.json found": Navigate to your project root directory
- "Failed to fix dependencies": Check your network connection and try again
- "Analysis failed": Ensure your package manager is properly installed
Future Scope
AI Integration
- 🤖 Local AI-powered dependency analysis using Ollama
- 📊 Smart version recommendations based on project context
- 🔍 Intelligent compatibility checking
- 🛡️ Automated security considerations
- 💡 Personalized upgrade path suggestions
These enhancements will help:
- Automate decision-making for version conflicts
- Predict potential compatibility issues
- Provide context-aware security recommendations
- Optimize dependency trees automatically
Requirements
- Node.js 14.x or higher
- One of the supported package managers installed
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT © Sudeepta Sarkar
Author
Sudeepta Sarkar sudsarkar13@gmail.com
Issues
If you encounter any problems or have suggestions for improvements, please file an issue at:
https://github.com/sudsarkar13/packages/issues