Skip to content

fix #4263: preserve resolved/integrity in package-lock.json when loading from cache#9688

Open
Amilliox wants to merge 1 commit into
npm:latestfrom
Amilliox:fix-4263-lockfile-resolved
Open

fix #4263: preserve resolved/integrity in package-lock.json when loading from cache#9688
Amilliox wants to merge 1 commit into
npm:latestfrom
Amilliox:fix-4263-lockfile-resolved

Conversation

@Amilliox

Copy link
Copy Markdown

Fixes #4263

Root cause: When node_modules/.package-lock.json (hidden lockfile) is rejected by assertNoNewer() (e.g., after deleting a package from node_modules), the resolved and integrity metadata for existing on-disk packages is lost. The regenerated package-lock.json is written without these fields, causing CI/CD failures, slow reinstalls (no integrity verification), and inconsistent lockfiles.

Fix: In load-actual.js, after loading the filesystem tree, try to recover resolved and integrity from the hidden lockfile for nodes that lack this metadata. This preserves the original tarball URLs and integrity hashes even when the hidden lockfile validation fails.

Verification:

  • Before: 69 resolved entries → 1 after reinstall
  • After: 69 resolved entries → 69 preserved

Files changed: workspaces/arborist/lib/arborist/load-actual.js (+22 lines)

@Amilliox Amilliox requested review from a team as code owners June 28, 2026 12:26
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.

npm install removes resolved and integrity properties from package-lock.json if installed from cache

1 participant