| name | deps |
| description | Manage dependencies with npm/yarn/pnpm. Use for auditing vulnerabilities, checking outdated packages, understanding dependency trees, and upgrading packages safely. |
Dependencies Manager
Audit, analyze, and manage project dependencies.
Prerequisites
At least one package manager:
node --version
npm install -g yarn
npm install -g pnpm
For dependency analysis:
npm install -g depcheck
CLI Reference
Security Audit
npm
npm audit
npm audit --json
npm audit --omit=dev
npm audit fix
npm audit fix --force
yarn
yarn audit
yarn audit --json
pnpm
pnpm audit
pnpm audit --json
Check Outdated Packages
npm
npm outdated
npm outdated --json
npm outdated --long
yarn
yarn outdated
pnpm
pnpm outdated
pnpm outdated --json
Upgrade Packages
npm
npm update
npm update lodash
npm install lodash@latest
npx npm-check -u
yarn
yarn upgrade
yarn upgrade lodash
yarn upgrade lodash@latest
yarn upgrade-interactive
pnpm
pnpm update
pnpm update lodash
pnpm update lodash --latest
pnpm update --interactive
Dependency Analysis
Why is this package installed?
npm explain lodash
npm ls lodash
yarn why lodash
pnpm why lodash
Find unused dependencies
npx depcheck
npx depcheck --json
npx depcheck --ignores="@types/*,eslint-*"
View Package Info
npm view lodash
npm view lodash version
npm view lodash versions
npm view lodash dependencies
npm view lodash repository.url
npm view lodash --json
Dependency Tree
npm ls
npm ls --depth=2
npm ls --omit=dev
npm ls lodash
npm ls --json
Workflow Patterns
Security Audit Workflow
npm audit --json > audit-report.json
npm audit --audit-level=high
npm audit fix
npm audit
Upgrade Workflow
npm outdated --json
npm test
npm update
npm test
npm install package@latest
npm test
Dependency Cleanup
npx depcheck
npm uninstall unused-package
npm test && npm run build
Investigating a Package
npm view express
npm ls express
npm explain express
npm audit | grep express
Common Issues
Peer Dependency Warnings
npm ls --json | grep peer
npm install missing-peer-dep
Version Conflicts
npm ls --all | grep "deduped"
npm dedupe
Lock File Issues
rm package-lock.json
npm install
rm yarn.lock
yarn install
Best Practices
- Audit regularly - Run
npm audit weekly or in CI
- Update incrementally - One major version at a time
- Test after updates - Always run tests post-update
- Review before fixing -
npm audit fix --force can break things
- Clean unused deps - Run
depcheck periodically
- Lock versions - Commit lock files to git
- Check before adding - Review package health before installing