Skip to content

fix: write GitHub Packages auth to NPM_CONFIG_USERCONFIG not ~/.npmrc#37

Merged
raphaelmansuy merged 1 commit intomainfrom
fix/github-packages-npmrc
Apr 13, 2026
Merged

fix: write GitHub Packages auth to NPM_CONFIG_USERCONFIG not ~/.npmrc#37
raphaelmansuy merged 1 commit intomainfrom
fix/github-packages-npmrc

Conversation

@raphaelmansuy
Copy link
Copy Markdown
Owner

Root cause

actions/setup-node sets NPM_CONFIG_USERCONFIG to a temp file (e.g. /home/runner/work/_temp/.npmrc). The GitHub Packages publish step was appending the scoped registry and auth token to ~/.npmrc, which npm never reads — causing ENEEDAUTH on every run.

Fix

Use ${NPM_CONFIG_USERCONFIG:-$HOME/.npmrc} as the target so npm actually picks up the token.

Verified diagnosis from CI run 24354302693

npm error code ENEEDAUTH

The npm publish step correctly skipped (already published), but GitHub Packages failed every attempt due to missing auth.

actions/setup-node sets NPM_CONFIG_USERCONFIG to a temp file; appending
the @raphaelmansuy scope and GitHub Packages token to ~/.npmrc was being
ignored, causing ENEEDAUTH on every GitHub Packages publish step.
@raphaelmansuy raphaelmansuy merged commit a466b24 into main Apr 13, 2026
4 of 8 checks passed
@raphaelmansuy raphaelmansuy deleted the fix/github-packages-npmrc branch April 13, 2026 16:45
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