Skip to content

fix: preserve file: and git-hosted tarball URLs in lockfile#11410

Merged
zkochan merged 1 commit into
mainfrom
fix/11407
Apr 30, 2026
Merged

fix: preserve file: and git-hosted tarball URLs in lockfile#11410
zkochan merged 1 commit into
mainfrom
fix/11407

Conversation

@zkochan

@zkochan zkochan commented Apr 30, 2026

Copy link
Copy Markdown
Member

Summary

  • Fixes ERR_PNPM_FETCH_404 when pnpm install --frozen-lockfile runs against a project whose dependency uses a file: tarball (#11407).
  • toLockfileResolution was dropping the tarball field for any resolution when lockfile-include-tarball-url=false (the default). For file: and git-hosted tarballs the URL cannot be reconstructed from package name + version + registry, so installs against the resulting lockfile fell back to the npm registry and 404'd. The check carried over from a v10 PR that was already reverted on the v10 branch but never propagated to v11.
  • Added a recovery path in pkgSnapshotToResolution so lockfiles already written by v11.0.0–v11.0.2 (which lost their file: tarball field) still install — the tarball is rebuilt from the depPath's nonSemverVersion.
  • The existing lockfileIncludeTarballUrl=false exclusion behavior for standard and non-standard registry URLs is preserved.

Test plan

  • pnpm --filter @pnpm/lockfile.utils test — all 9 unit tests pass, including new coverage for file:, git-hosted, and registry tarballs in toLockfileResolution, plus the recovery path in pkgSnapshotToResolution.
  • Manual end-to-end repro from the linked issue: a project with "test-package": "file:test-package-1.0.0.tgz" installs cleanly with the rebuilt bundle, both for fresh install and for --frozen-lockfile against a lockfile missing the tarball field.
  • Existing exclude tarball URL when lockfileIncludeTarballUrl is false and exclude non-standard tarball URL when lockfileIncludeTarballUrl is false tests in installing/deps-installer/test/lockfile.ts still pass.

@zkochan zkochan merged commit 76b9e48 into main Apr 30, 2026
11 of 12 checks passed
@zkochan zkochan deleted the fix/11407 branch April 30, 2026 20:07
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.

1 participant