DEV Community

Tihomir Ivanov
Tihomir Ivanov

Posted on

# How to Upgrade All NPM Packages in a Project using `ncu`

How to Upgrade All NPM Packages in a Project using ncu

If you're working on a Node.js or Next.js project and want to upgrade all your dependencies to their latest versions, here's a quick reminder guide using npm-check-updates (ncu).

Step 1: Install npm-check-updates Globally

npm install -g npm-check-updates
Enter fullscreen mode Exit fullscreen mode

Step 2: Check for Available Package Updates

ncu
Enter fullscreen mode Exit fullscreen mode

This shows you which packages in your package.json are outdated.

Step 3: Update package.json with the Latest Versions

ncu -u
Enter fullscreen mode Exit fullscreen mode

This installs the updated versions into your node_modules.

(Optional) Clean Install

rm -rf node_modules package-lock.json
npm install
Enter fullscreen mode Exit fullscreen mode

Useful if you want a clean dependency tree after upgrading.

Top comments (0)