Skip to content

[BUG] npm update downgrades lockfile version #3920

@valtlai

Description

@valtlai

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

lockfileVersion set to 3 in package-lock.json is downgraded back to 2 when running npm update.

Expected Behavior

I think the lockfile version should be preserved as is, not downgraded.

Steps To Reproduce

  1. Set the lockfileVersion property to 3 in a package-lock.json file. (You have to do it manually for now as the new lockfile-version option doesn’t yet really work.1)
  2. Run npm install, which deletes the legacy dependencies object and upgrades the hidden lockfile.
  3. Run npm update and you’ll see how the lockfile version is downgraded.

Environment

  • OS: MacOS 11.6
  • Node: 16.12.0, 17.0.1
  • npm: 8.1.0

Footnotes

  1. fix: --lockfile-version to handle string number #3900

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 1high priority issueRelease 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