Gathering detailed insights and metrics for npm-check-updates
Gathering detailed insights and metrics for npm-check-updates
Gathering detailed insights and metrics for npm-check-updates
Gathering detailed insights and metrics for npm-check-updates
npm-check
Check for outdated, incorrect, and unused dependencies.
simple-update-notifier
Simple update notifier to check for npm updates for cli applications
@badisi/latest-version
Get latest versions of packages
@juit/check-updates
Small and fast utility to update package dependencies
Find newer versions of package dependencies than what your package.json allows
npm install npm-check-updates
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (95.68%)
JavaScript (3.45%)
Shell (0.85%)
Dockerfile (0.02%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
NOASSERTION License
9,822 Stars
2,486 Commits
341 Forks
62 Watchers
13 Branches
133 Contributors
Updated on Jul 14, 2025
Latest Version
18.0.1
Package Id
npm-check-updates@18.0.1
Unpacked Size
5.29 MB
Size
1.47 MB
File Count
17
NPM Version
10.9.2
Node Version
22.14.0
Published on
Apr 24, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
84
npm-check-updates upgrades your package.json dependencies to the latest versions, ignoring specified versions.
"react": "^17.0.2"
to "react": "^18.3.1"
.npm install
to update your installed packages and package-lock.json.$${\color{red}Red}$$ major upgrade (and all major version zero)
$${\color{cyan}Cyan}$$ minor upgrade
$${\color{green}Green}$$ patch upgrade
Install globally to use npm-check-updates
or the shorter ncu
:
1npm install -g npm-check-updates
Or run with npx (only the long form is supported):
1npx npm-check-updates
Check the latest versions of all project dependencies:
1$ ncu 2Checking package.json 3[====================] 5/5 100% 4 5 eslint 7.32.0 → 8.0.0 6 prettier ^2.7.1 → ^3.0.0 7 svelte ^3.48.0 → ^3.51.0 8 typescript >3.0.0 → >4.0.0 9 untildify <4.0.0 → ^4.0.0 10 webpack 4.x → 5.x 11 12Run ncu -u to upgrade package.json
Upgrade 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.
1$ ncu -u 2Upgrading package.json 3[====================] 1/1 100% 4 5 express 4.12.x → 4.13.x 6 7Run npm install to install new versions. 8 9$ npm install # update installed packages and package-lock.json
Check global packages:
1ncu -g
Choose which packages to update in interactive mode:
1ncu --interactive 2ncu -i
Combine with --format group
for a truly luxe experience:
Filter packages using the --filter
option or adding additional cli arguments:
1# upgrade only mocha
2ncu mocha
3ncu -f mocha
4ncu --filter mocha
5
6# upgrade only chalk, mocha, and react
7ncu chalk mocha react
8ncu chalk, mocha, react
9ncu -f "chalk mocha react"
Filter with wildcards or regex:
1# upgrade packages that start with "react-" 2ncu react-* 3ncu "/^react-.*$/"
Exclude specific packages with the --reject
option or prefixing a filter with !
. Supports strings, wildcards, globs, comma-or-space-delimited lists, and regex:
1# upgrade everything except nodemon 2ncu \!nodemon 3ncu -x nodemon 4ncu --reject nodemon 5 6# upgrade packages that do not start with "react-". 7ncu \!react-* 8ncu '/^(?!react-).*$/' # mac/linux 9ncu "/^(?!react-).*$/" # windows
Advanced filters: filter, filterResults, filterVersion
2.0.1
→ 2.2.0
1.2
→ 1.3
0.1.0
→ 1.0.1
^1.2.0
→ ^2.0.0
1.x
→ 2.x
>0.2.0
→ >0.3.0
<2.0.0
→ ^3.0.0
1.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
--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.1
Options 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.{json,yml,js,cjs}) |
--configFilePath <path> | Directory of .ncurc config file. (default: directory of packageFile ) |
--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, or packageManager (comma-delimited). (default: ["prod","dev","optional","packageManager"]) |
--deprecated | Include deprecated packages. Use --no-deprecated to exclude deprecated packages (uses more bandwidth). (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, /regex/, or predicate function. |
--format <value> | Modify the output formatting or show additional information. Specify one or more comma-delimited values: group, ownerChanged, repo, time, lines, installedVersion. (default: []) |
-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. |
-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: ./package.json) |
-p, --packageManager <s> | npm, yarn, pnpm, deno, bun, staticRegistry (default: npm). |
--peer | Check peer dependencies of installed packages and filter updates to compatible versions. |
--pre <n> | Include prerelease versions, e.g. -alpha.0, -beta.5, -rc.2. Automatically set to 1 when --target is newest or greatest, or when the current version is a prerelease. (default: 0) |
--prefix <path> | Current working directory of npm. |
-r, --registry <uri> | Specify the registry to use when looking up package versions. |
--registryType <type> | Specify whether --registry refers to a full npm registry or a simple JSON file or url: npm, json. (default: npm) |
-x, --reject <p> | Exclude packages matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. |
--rejectVersion <p> | Exclude package.json versions using comma-or-space-delimited list, /regex/, or predicate function. |
--removeRange | Remove version ranges from the final package version. |
--retry <n> | Number of times to retry failed requests for package info. (default: 3) |
--root | Runs updates on the root project in addition to specified workspaces. Only allowed with --workspace or --workspaces . (default: true) |
-s, --silent | Don't output anything. Alias for --loglevel silent. |
--stdin | Read package.json from stdin. |
-t, --target <value> | Determines the version to upgrade to: latest, newest, greatest, minor, patch, semver, @[tag] |
--timeout <ms> | Global timeout in milliseconds. (default: no global timeout and 30 seconds per npm-registry-fetch) |
-u, --upgrade | Overwrite package file with upgraded versions instead of just outputting to console. |
--verbose | Log additional information for debugging. Alias for --loglevel verbose. |
-w, --workspace <s> | Run on one or more specified workspaces. Add --root to also upgrade the root project. (default: []) |
-ws, --workspaces | Run on all workspaces. Add --root to also upgrade the root project. |
Some options have advanced usage, or allow per-package values by specifying a function in your .ncurc.js file.
Run ncu --help [OPTION]
to view advanced help for a specific option, or see below:
Usage:
ncu --doctor -u
ncu --no-doctor
ncu -du
Iteratively installs upgrades and runs your project's tests to identify breaking upgrades. Reverts broken upgrades and updates package.json with working upgrades.
Requires -u
to execute (modifies your package file, lock file, and node_modules)
To be more precise:
npm install
and npm test
to ensure tests are currently passing.ncu -u
to optimistically upgrade all dependencies.Additional options:
--doctorInstall | specify a custom install script (default: `npm install` or `yarn`) |
--doctorTest | specify a custom test script (default: `npm test`) |
Example:
$ ncu --doctor -u
Running tests before upgrading
npm install
npm run test
Upgrading all dependencies and re-running tests
ncu -u
npm install
npm run test
Tests failed
Identifying broken dependencies
npm install
npm install --no-save react@16.0.0
npm run test
✓ react 15.0.0 → 16.0.0
npm install --no-save react-redux@7.0.0
npm run test
✗ react-redux 6.0.0 → 7.0.0
/projects/myproject/test.js:13
throw new Error('Test failed!')
^
npm install --no-save react-dnd@11.1.3
npm run test
✓ react-dnd 10.0.0 → 11.1.3
Saving partially upgraded package.json
Usage:
ncu --filter [p]
ncu -f [p]
Include only package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. Only included packages will be checked with --peer
.
--filter
runs before new versions are fetched, in contrast to --filterResults
which runs after.
You can also specify a custom function in your .ncurc.js file, or when importing npm-check-updates as a module.
:warning: The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at https://github.com/raineorshine/npm-check-updates#config-functions.
1/** 2 @param name The name of the dependency. 3 @param semver A parsed Semver array of the current version. 4 (See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring) 5 @returns True if the package should be included, false if it should be excluded. 6*/ 7filter: (name, semver) => { 8 if (name.startsWith('@myorg/')) { 9 return false 10 } 11 return true 12}
Filters results based on a user provided predicate function after fetching new versions.
filterResults
runs after new versions are fetched, in contrast to filter
, reject
, filterVersion
, and rejectVersion
, which run before. This allows you to exclude upgrades with filterResults
based on how the version has changed (e.g. a major version change).
:warning: The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at https://github.com/raineorshine/npm-check-updates#config-functions.
1/** Exclude major version updates. Note this could also be achieved with --target semver. 2 @param {string} packageName The name of the dependency. 3 @param {string} current Current version declaration (may be a range). 4 @param {SemVer[]} currentVersionSemver Current version declaration in semantic versioning format (may be a range). 5 @param {string} upgraded Upgraded version. 6 @param {SemVer} upgradedVersionSemver Upgraded version in semantic versioning format. 7 @returns {boolean} Return true if the upgrade should be kept, otherwise it will be ignored. 8*/ 9filterResults: (packageName, { current, currentVersionSemver, upgraded, upgradedVersionSemver }) => { 10 const currentMajor = parseInt(currentVersionSemver[0]?.major, 10) 11 const upgradedMajor = parseInt(upgradedVersionSemver?.major, 10) 12 if (currentMajor && upgradedMajor) { 13 return currentMajor >= upgradedMajor 14 } 15 return true 16}
For the SemVer type definition, see: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring
Usage:
ncu --filterVersion [p]
Include only versions matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.
--filterVersion
runs before new versions are fetched, in contrast to --filterResults
which runs after.
You can also specify a custom function in your .ncurc.js file, or when importing npm-check-updates as a module.
:warning: The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at https://github.com/raineorshine/npm-check-updates#config-functions. This function is an alias for the
filter
option function.
1/** 2 @param name The name of the dependency. 3 @param semver A parsed Semver array of the current version. 4 (See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring) 5 @returns True if the package should be included, false if it should be excluded. 6*/ 7filterVersion: (name, semver) => { 8 if (name.startsWith('@myorg/') && parseInt(semver[0]?.major) > 5) { 9 return false 10 } 11 return true 12}
Usage:
ncu --format [value]
Modify the output formatting or show additional information. Specify one or more comma-delimited values.
group | Groups packages by major, minor, patch, and major version zero updates. |
ownerChanged | Shows if the package owner has changed. |
repo | Infers and displays links to the package's source code repository. Requires packages to be installed. |
time | Shows the publish time of each upgrade. |
lines | Prints name@version on separate lines. Useful for piping to npm install. |
installedVersion | Prints the exact current version number instead of a range. |
Customize how packages are divided into groups when using --format group
.
Only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at https://github.com/raineorshine/npm-check-updates#config-functions.
1/** 2 @param name The name of the dependency. 3 @param defaultGroup The predefined group name which will be used by default. 4 @param currentSpec The current version range in your package.json. 5 @param upgradedSpec The upgraded version range that will be written to your package.json. 6 @param upgradedVersion The upgraded version number returned by the registry. 7 @returns A predefined group name ('major' | 'minor' | 'patch' | 'majorVersionZero' | 'none') or a custom string to create your own group. 8*/ 9groupFunction: (name, defaultGroup, currentSpec, upgradedSpec, upgradedVersion) => { 10 if (name === 'typescript' && defaultGroup === 'minor') { 11 return 'major' 12 } 13 if (name.startsWith('@myorg/')) { 14 return 'My Org' 15 } 16 return defaultGroup 17}
Usage:
ncu --install [value]
Default: prompt
Control the auto-install behavior.
always | Runs your package manager's install command automatically after upgrading. |
never | Does not install and does not prompt. |
prompt | Shows a message after upgrading that recommends an install, but does not install. In interactive mode, prompts for install. (default) |
Usage:
ncu --packageManager [s]
ncu -p [s]
Specifies the package manager to use when looking up versions.
npm | System-installed npm. Default. |
yarn | System-installed yarn. Automatically used if yarn.lock is present. |
pnpm | System-installed pnpm. Automatically used if pnpm-lock.yaml is present. |
bun | System-installed bun. Automatically used if bun.lock or bun.lockb is present. |
Usage:
ncu --peer
ncu --no-peer
Check peer dependencies of installed packages and filter updates to compatible versions.
Example:
The following example demonstrates how --peer
works, and how it uses peer dependencies from upgraded modules.
The package ncu-test-peer-update has two versions published:
"ncu-test-return-version": "1.0.x"
"ncu-test-return-version": "1.1.x"
Our test app has the following dependencies:
"ncu-test-peer-update": "1.0.0",
"ncu-test-return-version": "1.0.0"
The latest versions of these packages are:
"ncu-test-peer-update": "1.1.0",
"ncu-test-return-version": "2.0.0"
With --peer
:
ncu upgrades packages to the highest version that still adheres to the peer dependency constraints:
ncu-test-peer-update 1.0.0 → 1.1.0
ncu-test-return-version 1.0.0 → 1.1.0
Without --peer
:
As a comparison: without using the --peer
option, ncu will suggest the latest versions, ignoring peer dependencies:
ncu-test-peer-update 1.0.0 → 1.1.0
ncu-test-return-version 1.0.0 → 2.0.0
Usage:
ncu --registryType [type]
Specify whether --registry
refers to a full npm registry or a simple JSON file.
npm | Default npm registry |
json | Checks versions from a file or url to a simple JSON registry. Must include the `--registry` option.
Example:
registry.json:
|
Usage:
ncu --reject [p]
ncu -x [p]
The inverse of --filter
. Exclude package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. This will also exclude them from the --peer
check.
--reject
runs before new versions are fetched, in contrast to --filterResults
which runs after.
You can also specify a custom function in your .ncurc.js file, or when importing npm-check-updates as a module.
:warning: The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at https://github.com/raineorshine/npm-check-updates#config-functions.
1/** 2 @param name The name of the dependency. 3 @param semver A parsed Semver array of the current version. 4 (See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring) 5 @returns True if the package should be excluded, false if it should be included. 6*/ 7reject: (name, semver) => { 8 if (name.startsWith('@myorg/')) { 9 return true 10 } 11 return false 12}
Usage:
ncu --rejectVersion [p]
The inverse of --filterVersion
. Exclude versions matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.
--rejectVersion
runs before new versions are fetched, in contrast to --filterResults
which runs after.
You can also specify a custom function in your .ncurc.js file, or when importing npm-check-updates as a module.
:warning: The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at https://github.com/raineorshine/npm-check-updates#config-functions. This function is an alias for the reject option function.
1/** 2 @param name The name of the dependency. 3 @param semver A parsed Semver array of the current version. 4 (See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring) 5 @returns True if the package should be excluded, false if it should be included. 6*/ 7rejectVersion: (name, semver) => { 8 if (name.startsWith('@myorg/') && parseInt(semver[0]?.major) > 5) { 9 return true 10 } 11 return false 12}
Usage:
ncu --target [value]
ncu -t [value]
Determines the version to upgrade to. (default: "latest")
greatest | Upgrade to the highest version number published, regardless of release date or tag. Includes prereleases. |
latest | Upgrade to whatever the package's "latest" git tag points to. Excludes prereleases unless --pre is specified. |
minor | Upgrade to the highest minor version without bumping the major version. |
newest | Upgrade to the version with the most recent publish date, even if there are other version numbers that are higher. Includes prereleases. |
patch | Upgrade to the highest patch version without bumping the minor or major versions. |
semver | Upgrade to the highest version within the semver range specified in your package.json. |
@[tag] | Upgrade to the version published to a specific tag, e.g. 'next' or 'beta'. |
e.g.
ncu --target semver
You can also specify a custom function in your .ncurc.js file, or when importing npm-check-updates as a module.
:warning: The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at https://github.com/raineorshine/npm-check-updates#config-functions.
1/** Upgrade major version zero to the next minor version, and everything else to latest. 2 @param name The name of the dependency. 3 @param semver A parsed Semver object of the upgraded version. 4 (See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring) 5 @returns One of the valid target values (specified in the table above). 6*/ 7target: (name, semver) => { 8 if (parseInt(semver[0]?.major) === '0') return 'minor' 9 return 'latest' 10}
Add a .ncurc.{json,yml,js,cjs}
file to your project directory to specify configuration information.
For example, .ncurc.json
:
1{ 2 "upgrade": true, 3 "filter": "svelte", 4 "reject": ["@types/estree", "ts-node"] 5}
Options are merged with the following precedence:
$HOME
)You can also specify a custom config file name or path using the --configFileName
or --configFilePath
command line options.
Some options offer more advanced configuration using a function definition. These include filter, filterVersion, filterResults, reject, rejectVersion, and groupFunction. To define an options function, convert the config file to a JS file by adding the .js
extension and setting module.exports:
For example, .ncurc.js
:
1module.exports = { 2 upgrade: true, 3 filter: name => name.startsWith('@myorg/'), 4}
If you write .ncurc
config files using json or yaml, you can add the JSON Schema to your IDE settings for completions.
e.g. for VS Code:
1 "json.schemas": [ 2 { 3 "fileMatch": [ 4 ".ncurc", 5 ".ncurc.json", 6 ], 7 "url": "https://raw.githubusercontent.com/raineorshine/npm-check-updates/main/src/types/RunOptions.json" 8 } 9 ], 10 "yaml.schemas": { 11 "https://raw.githubusercontent.com/raineorshine/npm-check-updates/main/src/types/RunOptions.json": [ 12 ".ncurc.yml", 13 ] 14 },
npm-check-updates can be imported as a module:
1import ncu from 'npm-check-updates' 2 3const upgraded = await ncu.run({ 4 // Pass any cli option 5 packageFile: '../package.json', 6 upgrade: true, 7 // Defaults: 8 // jsonUpgraded: true, 9 // silent: true, 10}) 11 12console.log(upgraded) // { "mypackage": "^2.0.0", ... }
Contributions are happily accepted. I respond to all PR's and can offer guidance on where to make changes. For contributing tips see CONTRIBUTING.md.
File an issue. Please search existing issues first.
No vulnerabilities found.
Reason
7 commit(s) and 11 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
SAST tool is run on all commits
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
license file detected
Details
Reason
4 existing vulnerabilities detected
Details
Reason
Found 8/30 approved changesets -- score normalized to 2
Reason
dependency not pinned by hash detected -- score normalized to 1
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More