Skip to content

Conversation

@MaxBlack-dev
Copy link
Contributor

Description

This PR clarifies that the version field in package-lock.json dependency objects may be omitted in certain cases.

Changes

  • Added a note explaining that the version field is not always present
  • Specified that optional peer dependencies that are not installed may only have metadata fields (dev, optional, peer) without a version field
  • Updated documentation to match actual package-lock.json behavior

Context

Users discovered that some dependency objects in package-lock.json don't include a version field (e.g., optional peer dependencies), but the documentation stated that version is always present. This caused confusion when tools tried to parse these lockfiles. The example from the issue showed entries with only "dev": true, "optional": true, "peer": true fields.

Closes #4796

@MaxBlack-dev MaxBlack-dev requested a review from a team as a code owner November 30, 2025 02:02
@owlstronaut owlstronaut merged commit a367f9b into npm:latest Dec 1, 2025
8 checks passed
@github-actions github-actions bot mentioned this pull request Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOCS] Details for package-lock.json dependencies version field missing

2 participants