Quick Start Guide
This guide will walk you through the basic workflow of checking and upgrading your project's dependencies using npm-check-updates
.
Step 1: Check for Updates
Navigate to your project's root directory (where your package.json
is located) and run the ncu
command:
ncu
This will check all dependencies in your package.json
and display any available updates in a color-coded table.
Example Output:
$ ncu
Checking package.json
[====================] 5/5 100%
eslint 7.32.0 → 8.0.0
prettier ^2.7.1 → ^3.0.0
svelte ^3.48.0 → ^3.51.0
typescript >3.0.0 → >4.0.0
untildify <4.0.0 → ^4.0.0
webpack 4.x → 5.x
Run ncu -u to upgrade package.json
No files have been changed yet. This is a dry run.
Step 2: Upgrade Your package.json
To apply the updates to your package.json
, use the -u
(or --upgrade
) flag.
Warning: Make sure your
package.json
is committed to version control before running this command, as it will overwrite the file.
ncu -u
Your package.json
file is now updated with the latest versions.
Step 3: Install the New Packages
npm-check-updates
only modifies your package.json
. You still need to install the new package versions using your package manager.
For npm:
npm install
For yarn:
yarn install
For pnpm:
pnpm install
For bun:
bun install
This will update your installed packages in node_modules
and regenerate your lock file (package-lock.json
, yarn.lock
, etc.) based on the newly specified versions.
That's it! Your project's dependencies are now up-to-date.