Skip to content

Commit 01aa5b9

Browse files
authored
fix(corp-mirrors): resolve @pnpm from npmjs registry (#120)
## Summary - Scope only the `@pnpm` package to the npmjs registry so pnpm's package-manager self-install resolves canonically, while every other install keeps flowing through the corp artifactory mirror. ## Why pnpm 11 hardened its package-manager self-install: when a repo pins `packageManager` (e.g. `pnpm@10.23.0`), pnpm fetches it as `@pnpm/exe` and asserts an **integrity-only** resolution. The artifactory npm mirror rewrites the tarball host to its own domain, so the resolution carries a `tarball` field alongside `integrity` and the assertion throws. The result is that every `pnpm` invocation in such a repo fails with: ``` The packageManager dependency "@pnpm/exe@10.23.0" in pnpm-lock.yaml must use a registry package path and an integrity-only resolution ``` This is not the pnpm version, the pin format, or `manage-package-manager-versions`. Each variable was isolated to confirm the sole trigger is the mirror's rewritten tarball host. Pinning the `@pnpm` scope to npmjs makes the package manager resolve from the canonical registry, where the resolution is integrity-only and the assertion passes. ## Test plan - [x] `nixos-rebuild switch --flake .#wsl` applies cleanly - [x] `pnpm --version` in a repo pinning `packageManager` returns the pinned version instead of erroring - [x] `pnpm install`, `pnpm lint`, and a Dockerfile `pnpm` build all run - [x] Non-`@pnpm` installs still resolve through the artifactory mirror
1 parent 2dc6bf1 commit 01aa5b9

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

.cspell/words.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ nixsw
161161
nixup
162162
nlsv
163163
nofile
164+
npmjs
164165
nslookup
165166
nspr
166167
numtide

home/modules/corp-mirrors/default.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,12 @@ in
116116
# ----------------------------------------------------------------------
117117
# Node.js Development
118118
# ----------------------------------------------------------------------
119+
# Resolve @pnpm from npmjs. pnpm 11 rejects the mirror's rewritten
120+
# tarball host when self-installing a pinned packageManager.
119121
".npmrc".text = lib.mkForce ''
120122
manage-package-manager-versions=true
121123
registry=${npmMirror}
124+
@pnpm:registry=https://registry.npmjs.org/
122125
'';
123126

124127
# ----------------------------------------------------------------------

0 commit comments

Comments
 (0)