How to Upgrade Your package.json Dependencies

1 min read
Keeping your dependencies up to date is important for security, performance, and access to new features. Here's a quick guide to upgrading your package.json
packages — no fluff, just what you need.
1. Upgrade All to Latest (NPM)
Use npm-check-updates
to update everything to the latest versions:
npm install -g npm-check-updates
ncu -u
npm install
ncu -u
updatespackage.json
with the latest versions.npm install
installs them.
2. Upgrade a Specific Package
npm install package-name@latest
Want a specific version?
npm install package-name@^2.0.0
3. Patch/Minor Updates Only
npm update
This respects version ranges (like ^1.2.0
) and keeps things safe.
If You Use Bun
bun upgrade
Or upgrade a single package:
bun add package-name@latest
For Yarn Users
yarn upgrade --latest
Final Tips
Always check your app after updates.
Review your lock files (
package-lock.json
,bun.lockb
, oryarn.lock
).Use version ranges wisely (
^
,~
, or exact).
Stay updated, stay safe!
0
Subscribe to my newsletter
Read articles from Eric Kweyunga directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
