LinuxCommandLibrary

npm-check

Check for outdated, incorrect npm package dependencies

TLDR

Display a report of outdated, incorrect, and unused dependencies

$ npm-check
copy

Interactively update out-of-date packages
$ npm-check [[-u|--update]]
copy

Update everything without prompting
$ npm-check [[-y|--update-all]]
copy

Don't check for unused packages
$ npm-check [[-s|--skip-unused]]
copy

SYNOPSIS

npm-check [options]

PARAMETERS

-u, --update
    Interactively update outdated packages.

-s, --skip-unused
    Do not check for unused packages.

-i, --skip-incompatible
    Do not check for incompatible package versions.

-g, --global
    Check global packages instead of local project dependencies.

-E, --save-exact
    When updating, save the exact version number (no caret or tilde).

-p, --production
    Check only production dependencies, skipping development dependencies.

-D, --dev
    Check only development dependencies, skipping production dependencies.

-y, --yarn
    Force npm-check to use Yarn for package operations.

--clear-cache
    Clear npm-check's internal cache.

--json
    Output results in JSON format instead of the interactive CLI.

--ignore-dev-only
    Skip checking 'dev-only' packages that are unused when the production flag is used.

-v, --version
    Display the version number of npm-check.

-h, --help
    Display help information for npm-check.

DESCRIPTION

npm-check is a command-line tool designed to help developers manage Node.js project dependencies efficiently. It scans the package.json file and the node_modules directory to identify several issues: outdated dependencies, packages that are listed but not used, packages that are used but not listed, and even incorrect versions. It presents the information in a clear, color-coded, interactive interface, making it easy to see which packages need attention. A significant feature is its ability to interactively update outdated packages, allowing users to select which ones to upgrade. This tool enhances project maintainability and reduces dependency-related issues, ensuring a healthy and up-to-date project environment.

CAVEATS

Requires Node.js and either npm or Yarn to be installed.
May not perfectly detect all 'unused' packages in complex applications with dynamic imports.
Interactive update mode can be slow for projects with a large number of dependencies.
This is a third-party tool, not part of the core npm CLI.

INTERACTIVITY

npm-check is renowned for its interactive command-line interface, which allows users to navigate and select packages for updates directly within the terminal, providing a highly engaging user experience.

COLOR-CODED OUTPUT

The tool utilizes different colors to highlight the status of dependencies (e.g., green for up-to-date, yellow for minor updates, red for major updates or issues), significantly improving readability and enabling quick identification of problems.

HISTORY

npm-check was created to provide a more comprehensive and user-friendly alternative to the native npm outdated command. Its interactive interface and ability to check for unused and incompatible packages differentiate it. It is an open-source project that has seen continuous development by its community since its inception.

SEE ALSO

npm(1), npm-outdated(1), npm-install(1), yarn(1)

Copied to clipboard