claude-code - ✅(Solved) Fix Bun global install can leave claude wrapper without native binary [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#50203Fetched 2026-04-18 05:56:49
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
labeled ×3closed ×1commented ×1cross-referenced ×1

Installing @anthropic-ai/claude-code globally with Bun can appear to succeed but leaves a non-working claude command because Bun blocks dependency lifecycle scripts such as postinstall by default.

This is probably expected from Bun's security model, but the current Claude Code fallback error does not mention Bun or the Blocked 1 postinstall clue, so users may not understand why the package manager reported success while claude --version fails.

Error Message

Error: claude native binary not installed.

Either postinstall did not run (--ignore-scripts, some pnpm configs) or the platform-native optional dependency was not downloaded (--omit=optional).

Root Cause

Bun global install leaves claude wrapper without native binary because postinstall is blocked

Fix Action

Workaround

Use the native installer:

curl -fsSL https://claude.ai/install.sh | bash
claude --version

In the same isolated environment, that installed and verified 2.1.113 (Claude Code) successfully.

PR fix notes

PR #1635: fix(docker): install Claude Code with native installer

Description (problem / solution / changelog)

Summary

Fixes #1633 by replacing bun install -g @anthropic-ai/claude-code in both Docker images with Anthropic's native Claude Code installer, followed by an immediate claude --version verification.

Root cause

@anthropic-ai/claude-code depends on a package postinstall script plus platform-native optional dependencies to put the real Claude Code binary in place. Bun 1.3.11 installs the wrapper but blocks that dependency postinstall by default, exits 0, and leaves claude failing at runtime with claude native binary not installed.

Changes

  • Updated Dockerfile and coolify/Dockerfile to install Claude Code via https://claude.ai/install.sh and verify the CLI during image build.
  • Kept Bun for the other AI CLI packages that were not part of this failure.
  • Added tests/test-claude-code-install-method.mjs and included it in npm test so the Bun install path is not reintroduced.
  • Added the requested case study and downloaded data under docs/case-studies/issue-1633/.
  • Created upstream Claude Code report: https://github.com/anthropics/claude-code/issues/50203
  • Stabilized a merged-main flaky limits-display timing assertion so npm test passes after merging origin/main.
  • Added a patch changeset.

Reproduction

Before the fix, an isolated Bun install reproduces the issue:

HOME=/tmp/issue-1633-bun-home \
BUN_INSTALL=/tmp/issue-1633-bun-home/.bun \
bun install -g @anthropic-ai/[email protected]

HOME=/tmp/issue-1633-bun-home \
BUN_INSTALL=/tmp/issue-1633-bun-home/.bun \
PATH=/tmp/issue-1633-bun-home/.bun/bin:$PATH \
claude --version

Observed: Blocked 1 postinstall during install, then Error: claude native binary not installed.

The native installer was verified in an isolated HOME and produced 2.1.113 (Claude Code).

Test plan

  • node tests/test-claude-code-install-method.mjs
  • node tests/limits-display.test.mjs
  • npm test
  • npm run lint
  • npx prettier --check package.json tests/test-claude-code-install-method.mjs tests/limits-display.test.mjs docs/case-studies/issue-1633/README.md docs/case-studies/issue-1633/research-sources.json docs/case-studies/issue-1633/upstream-anthropic-issue.md .changeset/native-claude-installer.md
  • git diff --check

Docker build was not run locally because docker is not installed in this container; the install behavior is covered by the isolated native-installer smoke run saved in the case study.

Changed files

  • .changeset/native-claude-installer.md (added, +5/-0)
  • Dockerfile (modified, +8/-2)
  • coolify/Dockerfile (modified, +8/-2)
  • docs/case-studies/issue-1633/README.md (added, +144/-0)
  • docs/case-studies/issue-1633/data/anthropics-claude-code-bun-issues.json (added, +12/-0)
  • docs/case-studies/issue-1633/data/anthropics-claude-code-repo.json (added, +1/-0)
  • docs/case-studies/issue-1633/data/bun-claude-code-postinstall-issues.json (added, +1/-0)
  • docs/case-studies/issue-1633/data/claude-code-2.1.113-npm-view.json (added, +21/-0)
  • docs/case-studies/issue-1633/data/issue-1633-comments.json (added, +1/-0)
  • docs/case-studies/issue-1633/data/issue-1633.json (added, +12/-0)
  • docs/case-studies/issue-1633/data/linked-solve-log.txt (added, +1462/-0)
  • docs/case-studies/issue-1633/data/pr-1632-report-comment-4271462091.json (added, +35/-0)
  • docs/case-studies/issue-1633/data/pr-1632.json (added, +30/-0)
  • docs/case-studies/issue-1633/data/upstream-anthropic-issue-url.txt (added, +1/-0)
  • docs/case-studies/issue-1633/research-sources.json (added, +22/-0)
  • docs/case-studies/issue-1633/upstream-anthropic-issue.md (added, +78/-0)
  • package.json (modified, +1/-1)
  • tests/limits-display.test.mjs (modified, +43/-9)
  • tests/test-claude-code-install-method.mjs (added, +19/-0)

Code Example

rm -rf /tmp/claude-bun-home
mkdir -p /tmp/claude-bun-home

HOME=/tmp/claude-bun-home \
BUN_INSTALL=/tmp/claude-bun-home/.bun \
bun install -g @anthropic-ai/claude-code@2.1.113

HOME=/tmp/claude-bun-home \
BUN_INSTALL=/tmp/claude-bun-home/.bun \
PATH=/tmp/claude-bun-home/.bun/bin:$PATH \
claude --version

---

bun add v1.3.11 (af24e281)
installed @anthropic-ai/claude-code@2.1.113 with binaries:
 - claude

Blocked 1 postinstall. Run `bun pm -g untrusted` for details.

---

Error: claude native binary not installed.

Either postinstall did not run (--ignore-scripts, some pnpm configs)
or the platform-native optional dependency was not downloaded
(--omit=optional).

---

curl -fsSL https://claude.ai/install.sh | bash
claude --version

---

If you installed with Bun, Bun may have blocked the postinstall script.
Use the native installer, install with npm, or explicitly trust/run the
Claude Code postinstall in Bun.
RAW_BUFFERClick to expand / collapse

Bun global install leaves claude wrapper without native binary because postinstall is blocked

Summary

Installing @anthropic-ai/claude-code globally with Bun can appear to succeed but leaves a non-working claude command because Bun blocks dependency lifecycle scripts such as postinstall by default.

This is probably expected from Bun's security model, but the current Claude Code fallback error does not mention Bun or the Blocked 1 postinstall clue, so users may not understand why the package manager reported success while claude --version fails.

Reproduction

Environment:

  • Linux x64
  • Bun 1.3.11
  • Claude Code 2.1.113

Use an isolated home so the repro does not depend on an existing install:

rm -rf /tmp/claude-bun-home
mkdir -p /tmp/claude-bun-home

HOME=/tmp/claude-bun-home \
BUN_INSTALL=/tmp/claude-bun-home/.bun \
bun install -g @anthropic-ai/[email protected]

HOME=/tmp/claude-bun-home \
BUN_INSTALL=/tmp/claude-bun-home/.bun \
PATH=/tmp/claude-bun-home/.bun/bin:$PATH \
claude --version

Observed install output:

bun add v1.3.11 (af24e281)
installed @anthropic-ai/[email protected] with binaries:
 - claude

Blocked 1 postinstall. Run `bun pm -g untrusted` for details.

Observed claude --version output:

Error: claude native binary not installed.

Either postinstall did not run (--ignore-scripts, some pnpm configs)
or the platform-native optional dependency was not downloaded
(--omit=optional).

Workaround

Use the native installer:

curl -fsSL https://claude.ai/install.sh | bash
claude --version

In the same isolated environment, that installed and verified 2.1.113 (Claude Code) successfully.

Suggested fix

The install docs already recommend the native installer, and Bun's behavior is intentional. The actionable improvement would be to update the fallback error text and/or troubleshooting docs to explicitly mention Bun, for example:

If you installed with Bun, Bun may have blocked the postinstall script.
Use the native installer, install with npm, or explicitly trust/run the
Claude Code postinstall in Bun.

That would make the root cause clear when Bun exits successfully but reports Blocked 1 postinstall.

Related downstream report

This was found while fixing https://github.com/link-assistant/hive-mind/issues/1633.

extent analysis

TL;DR

To resolve the issue with claude not working after global installation with Bun, use the native installer or update the fallback error text to mention Bun's postinstall blocking behavior.

Guidance

  • The issue is caused by Bun blocking the postinstall script by default, which is necessary for the claude command to work properly.
  • To verify if Bun is blocking the postinstall script, look for the "Blocked 1 postinstall" message in the installation output.
  • As a workaround, use the native installer by running curl -fsSL https://claude.ai/install.sh | bash to install claude.
  • To mitigate this issue in the future, update the installation documentation to recommend using the native installer or explicitly trusting the claude postinstall script in Bun.

Example

No code snippet is necessary for this issue, as the solution involves using the native installer or updating documentation.

Notes

This issue is specific to installations using Bun and may not affect installations using other package managers like npm.

Recommendation

Apply the workaround by using the native installer, as it provides a clear and reliable way to install claude and avoid issues with postinstall scripts being blocked by Bun.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - ✅(Solved) Fix Bun global install can leave claude wrapper without native binary [1 pull requests, 1 comments, 2 participants]