Software Engineering6 min read
Npm package upgrade tips
2025-06-20

So you have to upgrade some npm packages eh?
Here are practical commands I've used to upgrade and manage dependencies more safely.
1) Check outdated packages
Use npm outdated to compare current, wanted, and latest versions.
2) Explore dependency tree
Use npm ls to inspect dependency relationships.
For a specific package:
npm ls webpacknpm ls replace-ext
3) Force reinstall everything cleanly
If dependencies are out of sync:
rm -rf node_modules package-lock.jsonnpm install
4) Trace deprecations
Use:
node --trace-deprecation
This helps identify which package is triggering warnings.
5) Audit vulnerabilities
npm auditnpm audit fix
For stubborn issues, manually upgrade the affected package versions.
6) Clean npm cache when needed
npm cache clean --force
Useful when local cache issues create confusing install behavior.
Reactions
Each reaction can be clicked once per page visit.