Skip to content

[BUG] npm ci doesn't exit when dependencies in lockfile do not match the package.json #3947

Description

@koenpunt

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When the package.json was updated with new dependencies, and the lockfile isn't, npm ci successfully installs the dependencies.

Expected Behavior

According to the documentation npm ci should exit when there's a discrepancy between the package.json and the lockfile.

If dependencies in the package lock do not match those in package.json, npm ci will exit with an error, instead of updating the package lock.
https://docs.npmjs.com/cli/v7/commands/npm-ci

Steps To Reproduce

  1. Create an empty directory
  2. Initialize npm; npm init -f && npm install
  3. Add a dependency to the package.json, but don't update the package-lock.json;
    npm install --save --no-package-lock leftpad
    
  4. Run npm ci
  5. See: There's no error.

Environment

  • OS: macOS
  • Node: 14.16.0
  • npm: 8.1.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingRelease 8.xwork is associated with a specific npm 8 release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions