Find newer versions of package dependencies than what your package.json allows
Find newer versions of package dependencies than what your package.json allows
npm-check-updates upgrades your package.json dependencies to the latest versions, ignoring specified versions.
"react": "^18.3.1" to "react": "^19.2.7".npm install to update your installed packages and package-lock.json.require()$${\color{red}Red}$$ major upgrade (and all major version zero)
$${\color{cyan}Cyan}$$ minor upgrade
$${\color{green}Green}$$ patch upgrade
^22.22.2 || ^24.15.0 || >=26.0.0>=10.0.0Install globally to use npm-check-updates or the shorter ncu:
npm install -g npm-check-updatesOr run with npx (only the long form is supported):
npx npm-check-updatesCheck the latest versions of all project dependencies:
$ 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.jsonUpgrade a project's package file:
Make sure your package file is in version control and all changes have been committed. This will overwrite your package file.
$ ncu -u
Upgrading package.json
[====================] 1/1 100%
express 4.12.x → 4.13.x
Run npm install to install new versions.
$ npm install # update installed packages and package-lock.jsonCheck global packages:
ncu -gChoose which packages to update in interactive mode:
ncu --interactive
ncu -iCombine with --format group for a truly luxe experience:
ncu -i pre-selects patch and minor upgrades, since --format group is enabled by default. Only when group formatting is disabled with --format no-group are all upgrades pre-selected, including major. Use --interactiveSelect to control this explicitly:
# start with nothing selected
ncu -i --interactiveSelect none
# pre-select patch upgrades only
ncu -i --interactiveSelect patch
# pre-select patch and minor upgrades
ncu -i --interactiveSelect minor
# pre-select everything, including major
ncu -i --interactiveSelect all
# the default: patch and minor with --format group, everything otherwise
# specify it explicitly to override a value set in your config file
ncu -i --interactiveSelect autoMajor version zero upgrades (e.g. 0.1.0 → 0.2.0) are only pre-selected by all, since anything may change before 1.0.0. Custom groups returned by --groupFunction are likewise only pre-selected by all.
Filter packages using the --filter option or adding additional cli arguments:
# upgrade only mocha
ncu mocha
ncu -f mocha
ncu --filter mocha
# upgrade only chalk, mocha, and react
ncu chalk mocha react
ncu chalk, mocha, react
ncu -f "chalk mocha react"Filter with wildcards or regex:
# upgrade packages that start with "react-"
ncu react-*
ncu "/^react-.*$/"Exclude specific packages with the --reject option or prefixing a filter with !. Supports strings, wildcards, globs, comma-or-space-delimited lists, and regex:
# upgrade everything except nodemon
ncu \!nodemon
ncu -x nodemon
ncu --reject nodemon
# upgrade packages that do not start with "react-".
ncu \!react-*
ncu '/^(?!react-).*$/' # mac/linux
ncu "/^(?!react-).*$/" # windowsAdvanced filters: filter, filterResults, filterVersion
2.0.1 → 2.2.01.2 → 1.30.1.0 → 1.0.1^1.2.0 → ^2.0.01.x → 2.x>0.2.0 → >0.3.0<2.0.0 → ^3.0.01.0.0 < 2.0.0 → ^3.0.0* → *--pre to include prerelease versions (e.g. alpha, beta, build1235)--target semver, update according to your specified semver version ranges:^1.1.0 → ^1.9.99^9.5.0 <10 → ^9.7.0 <10--target minor, strictly update the patch and minor versions (including major version zero):0.1.0 → 0.2.1--target patch, strictly update the patch version (including major version zero):0.1.0 → 0.1.2--target @next, update to the version published on the next tag:0.1.0 -> 0.1.1-next.1Options are merged with the following precedence:
$HOME)Options that take no arguments can be negated by prefixing them with --no-, e.g. --no-peer.
| --cache | Cache versions to a local cache file. Default --cacheFile is ~/.ncu-cache.json and default --cacheExpiration is 10 minutes. |
| --cacheClear | Clear the default cache, or the cache file specified by --cacheFile. |
| --cacheExpiration <min> | Cache expiration in minutes. Only works with --cache. (default: 10) |
| --cacheFile <path> | Filepath for the cache file. Only works with --cache. (default: "~/.ncu-cache.json") |
| --color | Force color in terminal. |
| --concurrency <n> | Max number of concurrent HTTP requests to registry. (default: 8) |
| --configFileName <s> | Config file name. (default: .ncurc or .ncurc.{json,yaml,yml,js,mjs,cjs}) |
| --configFilePath <path> | Directory of .ncurc config file. (default: directory of packageFile) |
| -c, --cooldown <period> | Sets a minimum age for package versions to be considered for upgrade. Accepts a number (days) or a string with a unit: "7d" (days), "12h" (hours), "30m" (minutes). Reduces the risk of installing newly published, potentially compromised packages. |
| --cwd <path> | Working directory in which npm will be executed. |
| --deep | Run recursively in current working directory. Alias of (--packageFile '**/package.json'). |
| --dep <value> | Check one or more sections of dependencies only: dev, optional, peer, prod, packageManager, or devEngines (comma-delimited). (default: ["prod","dev","optional","packageManager"]) |
| --deprecated | Include deprecated packages. Use --no-deprecated to exclude deprecated packages. (default: true) |
| -d, --doctor | Iteratively installs upgrades and runs tests to identify breaking upgrades. Requires -u to execute. |
| --doctorInstall <command> | Specifies the install script to use in doctor mode. (default: npm install or the equivalent for your package manager) |
| --doctorTest <command> | Specifies the test script to use in doctor mode. (default: npm test) |
| --enginesNode | Include only packages that satisfy engines.node as specified in the package file. |
| -e, --errorLevel <n> | Set the error level. 1: exits with error code 0 if no errors occur. 2: exits with error code 0 if no packages need updating (useful for continuous integration). (default: 1) |
| -f, --filter <p> | Include only package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. |
| filterResults <fn> | Filters results based on a user provided predicate function after fetching new versions. |
| --filterVersion <p> | Filter on package version using comma-or-space-delimited list or /regex/. |
| --format <value> | Modify the output formatting or show additional information. Specify one or more comma-delimited values: dep, group, ownerChanged, repo, time, lines, installedVersion, cooldown. group is the only value included by default; use --format no-group to disable it. (default: ["group"]) |
| -g, --global | Check global packages instead of in the current project. |
| groupFunction <fn> | Customize how packages are divided into groups when using --format group. |
| --install <value> | Control the auto-install behavior: always, never, prompt. (default: "prompt") |
| -i, --interactive | Enable interactive prompts for each dependency; implies -u unless one of the json options are set. |
| --interactiveSelect <value> | Control which upgrades are pre-selected in interactive mode: auto, none, patch, minor, all. Only applies with --interactive. (default: "auto") |
| -j, --jsonAll | Output new package file instead of human-readable message. |
| --jsonDeps | Like jsonAll but only lists dependencies, devDependencies, optionalDependencies, etc of the new package data. |
| --jsonUpgraded | Output upgraded dependencies in json. |
| -l, --loglevel <n> | Amount to log: silent, error, minimal, warn, info, verbose, silly. (default: "warn") |
| --mergeConfig | Merges nested configs with the root config file for --deep or --packageFile options. (default: false) |
| -m, --minimal | Do not upgrade newer versions that are already satisfied by the version range according to semver. |
| --packageData <value> | Package file data (you can also use stdin). |
| --packageFile <path|glob> | Package file(s) location. (default: ./pack |
peer dependency not recognized and major update applied
Allow filtering/rejecting specific version (range) of dependency
updates available but not recognized and not applied
npm error ERESOLVE unable to resolve dependency tree | Could not resolve dependency | dependency conflict eslin & eslint-config-next
Feature Request: Detect dead/deprecated packages.
Batch npm fetch
upgrade mirror should not upgrade to next version
New interactive mode breaks in IDE console
Feature request: Launch child process to automate "Run the following to upgrade all global packages"
Tie updates of Definitely Typed `@types/` packages to their corresponding code package