Skip to content

fix: add NODE_AUTH_TOKEN for npm publish authentication - #32

Merged
maplezzk merged 2 commits into
mainfrom
fix/release-npm-auth
Apr 28, 2026
Merged

maplezzk merged 2 commits into
mainfrom
fix/release-npm-auth

Conversation

@maplezzk

Copy link
Copy Markdown
Owner

问题

Release workflow 在 publish 步骤报 404:

npm error code E404
npm error 404 Not Found - PUT https://registry.npmjs.org/@maplezzk%2fmcps

虽然 OIDC provenance 签名成功,但 Trusted Publisher 的认证没有传递到 npm publish,导致 PUT 请求被拒。

修复

在 Publish to npm 步骤中添加 NODE_AUTH_TOKEN 环境变量:

env:
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

setup-node@v4 配置了 registry-url 后会自动写入 .npmrc,通过 NODE_AUTH_TOKEN 完成认证。

前置条件

需要确保 GitHub Secrets 中已配置 NPM_TOKEN(npm access token,类型为 Automation 或 Publish)。

Claude Bot and others added 2 commits April 28, 2026 23:08
Trusted Publisher OIDC alone resulted in 404 on npm PUT.
Adding NODE_AUTH_TOKEN as env var for the publish step.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@maplezzk
maplezzk merged commit 8a92f69 into main Apr 28, 2026
1 check passed
@maplezzk
maplezzk deleted the fix/release-npm-auth branch April 28, 2026 15:10
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