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

Resolved 💬 6 comments Opened Jun 10, 2025 by felixbuenemann Closed Sep 9, 2025

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 ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗