Skip to content

[BUG] npm install installs an invalid tree (as validated by npm ci) #5854

Description

@billyjanitsch

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

See the two commits in this repo.

The first commit is the result of running:

> npm install @pmmmwh/react-refresh-webpack-plugin@0.5.9 read-pkg-up@7.0.1
added 135 packages in 6s

This command exits without error, and correctly installs to node_modules/ and package-lock.json. However, the resulting tree is invalid, according to npm ci:

❯ npm ci
npm ERR! code EUSAGE
npm ERR! 
npm ERR! `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.

The second commit is the result of running npm install again. This updates the package lock to a valid tree, and npm ci now completes successfully.

Expected Behavior

It shouldn't be necessary to run npm install twice to get a valid tree.

Steps To Reproduce

See current behavior for a minimal repro repository.

Environment

  • npm: 9.1.1
  • Node.js: 18.12.0
  • OS Name: macOS
  • System Model Name: MacBook Pro (16-inch, 2019)
  • npm config: none

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 fixingPriority 1high priority issueRelease 9.xwork is associated with a specific npm 9 release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions