Overview
ECC automatically detects your preferred package manager (npm, pnpm, yarn, or bun) and uses it consistently across hooks, commands, and scripts.Detection Priority
The plugin detects your package manager in this order:- Environment variable:
CLAUDE_PACKAGE_MANAGER - Project config:
.claude/package-manager.json - package.json:
packageManagerfield - Lock file: Detection from package-lock.json, yarn.lock, pnpm-lock.yaml, or bun.lockb
- Global config:
~/.claude/package-manager.json - Fallback: First available package manager
Configuration Methods
1. Environment Variable (Highest Priority)
npm, pnpm, yarn, bun
2. Global Configuration
Applies to all projects unless overridden:~/.claude/package-manager.json:
3. Project Configuration
Applies to current project only:.claude/package-manager.json:
4. package.json Field
Add to yourpackage.json:
pnpm from this field.
5. Lock File Detection
If no explicit configuration exists, ECC detects from lock files:package-lock.json→ npmyarn.lock→ yarnpnpm-lock.yaml→ pnpmbun.lockb→ bun
Using the /setup-pm Command
Interactive configuration via Claude Code:
- Detects your current package manager
- Shows available package managers
- Lets you choose global or project-level configuration
- Creates the appropriate config file
Checking Current Configuration
Where It’s Used
Hooks
- Session start: Detects and displays package manager
- Build commands: Uses detected package manager for
npm run build→pnpm run build - Test commands: Uses detected package manager for test scripts
Commands
/tdd: Uses package manager to run tests/build-fix: Uses package manager for build commands/test-coverage: Uses package manager for coverage reports
Scripts
scripts/hooks/session-start.js: Package manager detectionscripts/setup-package-manager.js: Configuration utility
Cross-Platform Support
Package manager detection works on:- Windows: Full support (cmd.exe, PowerShell, Git Bash)
- macOS: Full support
- Linux: Full support
Supported Package Managers
| Package Manager | Detection | Installation Check | Notes |
|---|---|---|---|
| npm | ✅ package-lock.json | npm --version | Default fallback |
| pnpm | ✅ pnpm-lock.yaml | pnpm --version | Recommended for monorepos |
| yarn | ✅ yarn.lock | yarn --version | Classic and Berry supported |
| bun | ✅ bun.lockb | bun --version | Fast alternative |
Troubleshooting
”Package manager not found”
Cause: The detected package manager is not installed on your system. Fix:- Install the package manager:
npm install -g pnpm - Or change to an installed package manager:
/setup-pm
”Wrong package manager being used”
Cause: Higher-priority configuration is overriding your preference. Fix:- Check detection order:
node scripts/setup-package-manager.js --detect - Set environment variable to override all:
export CLAUDE_PACKAGE_MANAGER=pnpm
”Commands fail with package manager errors”
Cause: Lock file and package manager mismatch. Fix:- Delete the old lock file
- Set correct package manager:
/setup-pm - Reinstall dependencies