[BUG] claude update fails if BUN_INSTALL env var is set and running with node.js

Status Fixed / completed
Maintainer reply ✓ Yes — ant-kurt
Activity 6 comments · opened Jun 10, 2025 · closed Sep 9, 2025
💡 Likely answer: A maintainer (ant-kurt, collaborator) responded on this thread — see the highlighted reply below.

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.16
  • Operating System: macOS 15.5
  • Terminal: iTerm2

Bug Description

When you run claude code from a node.js global install (homebrew install, v23.11.0) and the BUN_INSTALL environment variable is set from a previous bun install, then the updater fails with a "Insufficient permissions to install update" error.

Steps to Reproduce

export BUN_INSTALL=~/.bun (from .zshrc, directory no longer exists)
claude code
Current version: 1.0.16
Checking for updates...
New version available: 1.0.17 (current: 1.0.16)
Installing update...
Using global installation update method...
Error: Insufficient permissions to install update
Try running with sudo or fix npm permissions
Or consider migrating to a local installation with:
  /migrate-installer

Expected Behavior

Claude code should not rely on environment variables to detect if it is running under bun, there is already an alternative check using process.versions.bun that coudl probably be used exclusively.

Actual Behavior

Claude code updater uses the bun.js uodate code path if BUN_INSTALL is set, even if it is running under node.js.

Additional Context

After unsetting BUN_INSTALL the update process works fine:

claude update
Current version: 1.0.16
Checking for updates...
New version available: 1.0.17 (current: 1.0.16)
Installing update...
Using global installation update method...
Successfully updated from 1.0.16 to version 1.0.17

View original on GitHub ↗

6 Comments

mehmetyiter · 1 year ago

sudo claude update
Current version: 0.2.78
Checking for updates...
New version available: 1.0.24 (current: 0.2.78)
Installing update...
Using global installation update method...
Successfully updated from 0.2.78 to version 1.0.24

claude -v
0.2.78 (Claude Code)

???!!!

ibehnam · 1 year ago

I have the same issue. Any solutions?

darkBuddha · 1 year ago

wtf i lost 30 min due to this

LeonNel123 · 1 year ago

This worked for me

Run the update with the variable unset for just this command

env -u BUN_INSTALL claude update

ant-kurt collaborator · 1 year ago

This should be addressed in the next release.

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.