Basic Usage
npm-check-updates
provides a simple yet powerful set of commands to manage your dependencies.
Checking for Updates
To check for the latest versions of all project dependencies, run ncu
in your project's root directory:
$ 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
This command performs a dry run and does not modify any files.
Upgrading the package.json File
To write the changes to your package.json
, use the -u
or --upgrade
flag.
Important: Ensure your
package.json
is under version control and all changes are committed before running this command, as it will directly modify the file.
$ ncu -u
Upgrading package.json
[====================] 1/1 100%
express 4.12.x → 4.13.x
Run npm install to install new versions.
After upgrading, you'll need to run your package manager's install command (e.g., npm install
) to update your node_modules
and lockfile.
Interactive Mode
For more control over which packages to update, use the interactive mode with -i
or --interactive
.
ncu -i
This will present a list of available updates, allowing you to select which ones to apply using the spacebar and arrow keys.
Combine interactive mode with --format group
for a categorized view of updates:
Checking Global Packages
To check for updates to your globally installed packages, use the -g
flag:
ncu -g