[BUG] `claude` code version >= `1.0.36` crashes with `bun` and `bunx`

Resolved 💬 8 comments Opened Jul 1, 2025 by real-timer Closed Jul 3, 2025

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other:
  • Claude CLI version: >= 1.0.36, …
  • Operating System: Windows 11, WSL2
  • Terminal: Windows Terminal

Bug Description

bunx @anthropic-ai/claude-code@1.0.36 # ❌
╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code!                         │
│                                                   │
│   /help for help, /status for your current setup  │
│                                                   │
│   cwd: /home/cetin/rt                             │
╰───────────────────────────────────────────────────╯


 ※ Tip: Use /permissions to pre-approve and pre-deny bash, edit, and MCP tools

╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ > Try "edit <filepath> to..."                                                                                                                                                                                                          │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
  ? for shortcuts                                                                                                                                                                                      ◯ Use /ide to connect to your IDE


2066 |
2067 | To update, please run:
2068 |     claude update
2069 |
2070 | This will ensure you have access to the latest features and improvements.
2071 | `),xI(1)}catch(A){d1(A)}}var ay=_L5(m4(),".update.lock"),yL5=300000;function kL5(){try{if(!f1().existsSync(m4()))f1().mkdirSync(m4());if(f1().existsSync(ay)){let A=f1().statSync(ay);if(Date.now()-A.mtimeMs<yL5)return!1;try{f1().unlinkSync(ay)}catch(Q){return d1(Q),!1}}return f1().writeFileSync(ay,`${process.pid}`,{encoding:"utf8",flush:!1}),!0}catch(A){return d1(A),!1}}function xL5(){try{if(f1().existsSync(ay)){if(f1().readFileSync(ay,{encoding:"utf8"})===`${process.pid}`)f1().unlinkSync(ay)}}catch(A){d1(A)}}async function vL5(){let A=nA.isRunningWithBun(),B=null;if(A)B=await e0("bun",["pm","bin","-g"]);else B=await e0("npm",["-g","config","get","prefix"]);if(B.code!==0)return d1(new Error(`Failed to check ${A?"bun":"npm"} permissions`)),null;return B.stdout.trim()}async function d2A(){try{let A=await vL5();if(!A)return{hasPermissions:!1,npmPrefix:null};let B=!1;try{f1().accessSync(A,jL5.W_OK),B=!0}catch{B=!1}if(B)return{hasPermissions:!0,npmPrefix:A};return d1(new Error("Insufficient permissions for global n | ... truncated

TypeError: B.stderr.trim is not a function. (In 'B.stderr.trim()', 'B.stderr.trim' is undefined)
      at QE1 (/tmp/bunx-1000-@anthropic-ai/claude-code@1.0.36/node_modules/@anthropic-ai/claude-code/cli.js:2071:775)

Bun v1.2.17 (Linux x64)

Steps to Reproduce

  1. bunx @anthropic-ai/claude-code@1.0.36 or …7 or …8
  2. ✔️ bunx @anthropic-ai/claude-code@1.0.35 (working fine)

Expected Behavior

It works.

Actual Behavior

B.stderr.trim() crash! See above!

Additional Context

See above!

View original on GitHub ↗

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