DashboardcraftCraft npm target auth: temp .npmrc via …

Craft npm target auth: temp .npmrc via npm_config_userconfig bypasses all default config

Category: architecture
Confidence: 1.00
ID: 019c9f57-aa0f-70b2-82fb-e87fb9fc591f
Project ID: e16af391-c497-4837-b681-c849a5514499
Cross-project: No
Recalled in other projects: 2
Source session: (none)
Created: 2026-06-10 21:07:09
Updated: 2026-06-10 21:07:09

Cross-Project Recalls

ProjectHitsLast recalled
Code 1 2026-07-23
opencode 1 2026-07-20

Content

Craft's npm target creates a temporary .npmrc file containing //registry.npmjs.org/:_authToken=${NPM_TOKEN} and sets the npm_config_userconfig env var to point to it. This completely overrides npm's default config file lookup chain — the user's home .npmrc and project .npmrc are both bypassed. This is why OIDC (which relies on setup-node creating a properly configured project .npmrc) requires a separate code path that skips the temp file entirely. The pattern is used in both publishPackage() and getLatestVersion(). The npm_config_userconfig approach (instead of --userconfig CLI flag) was chosen for yarn compatibility.

Move to: