Repository navigation
Description
What version of Bun is running?
1.3.1 (89fa0f3)
What platform is your computer?
GitHub Actions (ubuntu-latest)
What steps can reproduce the bug?
- Set up GitHub Actions workflow with Bun 1.3.1
- Create
.npmrcfile with valid NPM token:
- name: Setup npm authentication
run: |
cat > ~/.npmrc << EOF
//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
registry=https://registry.npmjs.org/
always-auth=true
EOF- Verify authentication works with npm:
npm whoami # ✅ Returns username successfully- Try to publish with bun:
bun publish --access public # ❌ Fails with authentication errorWhat is the expected behavior?
bun publish should read the .npmrc file and authenticate successfully, just like npm publish does.
What do you see instead?
error: missing authentication (run `bunx npm login`)
Additional information
What we tried:
- ✅
.npmrcin~/.npmrc- Failed - ✅
.npmrcin project root - Failed - ✅
.npmrcin working directory (packages/core/.npmrc) - Failed - ✅
NPM_CONFIG_TOKENenvironment variable - Failed - ✅
npm_config_//registry.npmjs.org/:_authTokenenvironment variable - Failed
Evidence that authentication is valid:
Running npm whoami before bun publish succeeds and returns the correct username, proving:
- The
.npmrcfile exists and is properly formatted - The NPM_TOKEN is valid
- npm can authenticate successfully
But bun publish immediately after still fails with "missing authentication".
Logs from GitHub Actions:
release Publish to npm npm whoami
release Publish to npm pep <-- ✅ npm authentication works!
release Publish to npm bun publish v1.3.1 (89fa0f34)
release Publish to npm $ bun run build
release Publish to npm ...
release Publish to npm error: missing authentication (run `bunx npm login`) <-- ❌ bun fails
Documentation discrepancy:
The Bun docs state:
"bun publish respects the NPM_CONFIG_TOKEN environment variable"
However, this doesn't appear to work in practice with Bun 1.3.1.
Workaround:
We had to revert to using npm publish instead of bun publish:
- name: Publish to npm
working-directory: ./packages/core
run: npm publish --access publicThis works perfectly with the same .npmrc configuration.
Repository with reproduction:
You can see our full workflow and all attempts at: PepijnSenders/markdown-di#14
Specifically see run logs: https://github.com/PepijnSenders/markdown-di/actions/runs/18837828691
Related issues:
- Support
bun publishauthentication using NPM tokens #16523 (marked as duplicate of NODE_AUTH_TOKEN or NPM_TOKEN support forbun publish#14824) - NODE_AUTH_TOKEN or NPM_TOKEN support for
bun publish#14824
This appears to be an ongoing issue with bun publish authentication in CI environments.
Activity
VesperQuartz commentedon Dec 10, 2025
I am having same error too
stonega commentedon Dec 11, 2025
Same issue.
raphaelbahat commentedon Dec 14, 2025
Any updates?
pricci1 commentedon Dec 25, 2025
I have a similar problem, but I'm trying to use NPM's Trusted Publishing, which I believe does not require a token (but I might be confused).
edit:
Can confirm that using
npm publishworks with my setup.pricci1/skillify@868404c...121a144
chore: fix publishing
evmd commentedon Jan 6, 2026
Had the same issue when trying to publish in CI.
Something isn't right, after login to npm and having a .npmrc in $HOME, calling bun publish will fail saying it's not authenticated, but doing the following :
export XDG_CONFIG_HOME="$HOME"before running publish solve the issue.
This really makes no sense.
Ant-Throw-Pology commentedon Feb 1, 2026
Same issue here, just not in Actions. Looks to me like Bun is looking in the wrong spot for
.npmrc. I don't want to move my$XDG_CONFIG_HOME. Instead, I triedcp ~/.npmrc $XDG_CONFIG_HOMEand that also worked.I think Bun needs to also look in
$HOMEfor an.npmrcinstead of just$XDG_CONFIG_HOME.evmd commentedon Feb 1, 2026
Just made a PR #26040 to address this fix, now just waiting for @Jarred-Sumner to take care of this annoying bug.
fix: fallback to npm publish
Teyik0 commentedon Mar 9, 2026
any news ?
3 remaining items
try to fix build actions oven-sh/bun#24124
ci(release): publish via bun pack + npm publish
fix(release): publish bun-packed tarball with npm (reliable CI auth) (#…
Authenticate npm publish via NPM_CONFIG_TOKEN
fix: use npm publish instead of bun publish in release workflow
fix(ci): point bun at XDG_CONFIG_HOME=\$HOME for publish auth
Jarred-Sumner commentedon Jul 28, 2026
@robobun adopt
robobun commentedon Jul 29, 2026
✅ Reproduced: with
XDG_CONFIG_HOMEset (GitHub Actions sets it to~/.config), bun never falls back to~/.npmrc.Fix in progress → #36289
install: fall back to $HOME/.npmrc when $XDG_CONFIG_HOME is set
fix(publish): use npm publish, bump to 2.0.1 (#164)
install: fall back to $HOME/.npmrc when $XDG_CONFIG_HOME is set
install: fall back to $HOME/.npmrc when $XDG_CONFIG_HOME is set (#36289)
ci: fix bun publish auth for scoped @breadAi packages
docs: document publishing with npm instead of bun publish