Check for outdated, incorrect, and unused dependencies.
Check for outdated, incorrect, and unused dependencies.
npm@3, so dependencies go where you expect them.
private: truein their package.json.
npm@3, as well as newer alternative installers like
This is the easiest way to use
$ npm install -g npm-check
The result should look like the screenshot, or something nice when your packages are all up-to-date and in use.
When updates are required it will return a non-zero response code that you can use in your CI tools.
Usage$ npm-check <path> <options>PathWhere to check. Defaults to current directory. Use -g for checking global modules.Options-u, --update Interactive update.-g, --global Look at global modules.-s, --skip-unused Skip check for unused packages.-p, --production Skip devDependencies.-i, --ignore Ignore dependencies based on succeeding glob.-E, --save-exact Save exact version (x.y.z) instead of caret (^x.y.z) in package.json.--no-color Force or disable color output.--no-emoji Remove emoji support. No emoji in default in CI environments.--debug Debug output. Throw in a gist when creating issues on github.Examples$ npm-check # See what can be updated, what isn't being used.$ npm-check ../foo # Check another path.$ npm-check -gu # Update globally installed modules by picking which ones to upgrade.
Show an interactive UI for choosing which modules to update.
Automatically updates versions referenced in the
Based on recommendations from the
npm-check only updates using
npm install, not
To avoid using more than one version of
npm in one directory,
npm-check will automatically install updated modules
using the version of
npm installed globally.
Set environment variable
NPM_CHECK_INSTALLER to the name of the installer you wish to use.
NPM_CHECK_INSTALLER=pnpm npm-check -u## pnpm install --save-dev foo@version --color=always
You can also use this for dry-run testing:
NPM_CHECK_INSTALLER=echo npm-check -u
Check the versions of your globally installed packages.
npm-check -u -g to do a safe interactive update of global modules, including npm itself.
npm-check will let you know if any of your modules are not being used by looking at
in your code.
This option will skip that check.
This is enabled by default when using
npm-check will look at packages listed as
This option will let it ignore outdated and unused checks for packages listed as
Ignore dependencies that match specified glob.
$ npm-check -i babel-* will ignore all dependencies starting with 'babel-'.
Install packages using
--save-exact, meaning exact versions will be saved in package.json.
Applies to both
Enable or disable color support.
npm-check uses colors if they are available.
Enable or disable emoji support. Useful for terminals that don't support them. Automatically disabled in CI servers.
Enable or disable the spinner. Useful for terminals that don't support them. Automatically disabled in CI servers.
The API is here in case you want to wrap this with your CI toolset.
const npmCheck = ;;
cwdis automatically set with this option.
--productionon the command line to match
x.y.zinstead of semver range
The result of the promise is a
currentState object, look in state.js to see how it works.
You will probably want
currentState.get('packages') to get an array of packages and the state of each of them.
Each item in the array will look like the following:
moduleName: 'lodash' // name of the module.homepage: '' // url to the home page.regError: undefined // error communicating with the registrypkgError: undefined // error reading the package.jsonlatest: '4.7.0' // latest according to the registry.installed: '4.6.1' // version installedisInstalled: true // Is it installed?notInstalled: false // Is it installed?packageWanted: '4.7.0' // Requested version from the package.json.packageJson: '^4.6.1' // Version or range requested in the parent package.json.devDependency: false // Is this a devDependency?usedInScripts: undefined // Array of `scripts` in package.json that use this module.mismatch: false // Does the version installed not match the range in package.json?semverValid: '4.6.1' // Is the installed version valid semver?easyUpgrade: true // Will running just `npm install` upgrade the module?bump: 'minor' // What kind of bump is required to get the latest, such as patch, minor, major.unused: false // Is this module used in the code?
You will also see this if you use
--debug on the command line.
Hi! Thanks for checking out this project! My name is Dylan Greene. When not overwhelmed with my two young kids I enjoy contributing to the open source community. I'm also a tech lead at Opower.
Here's some of my other Node projects:
||Automatic desktop notifications for Grunt errors and warnings. Supports OS X, Windows, Linux.|
||Amazingly short non-sequential url-friendly unique id generator.|
||Discover surprisingly large directories from the command line.|
||RSS feed generator. Add RSS feeds to any project. Supports enclosures and GeoRSS.|
||Interactive prompt for your Grunt config using console checkboxes, text input with filtering, password fields.|
||Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples.|
||Command line tool (and Node module) that generates a changelog in color output, markdown, or json for modules in npmjs.org's registry as well as any public github.com repo.|
||Display attention-grabbing messages in the terminal|
||Beautiful UI for showing tasks running on the command line.|
||Module information and stats for any @npmjs user|
||Echo a file to the terminal. Works with text, figlets, ascii art, and full-color ansi.|
This list was generated using anthology.
Copyright (c) 2016 Dylan Greene, contributors.
Released under the MIT license.
Screenshots are CC BY-SA (Attribution-ShareAlike).