[BUG] `claude` code version >= `1.0.36` crashes with `bun` and `bunx`
Status Fixed / completed
Maintainer reply None cached
Activity 8 comments · opened Jul 1, 2025 · 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
- ❌
bunx @anthropic-ai/claude-code@1.0.36or…7or…8 - ✔️
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!
8 Comments
Happening for me too on Bun 1.2.17 (latest as of today). Per bun's compatibility page:
So, it may be a good idea to file the issue over there as well.
It appears here that Claude Code (or one of its dependencies) is adding a new method to process.stdin.
I've noticed in the past that Bun doesn't let you modify some builtins such as process.stdin and process.stdout, so this doesn't work. Adding the
trimmethod fails silently and so it is not present later when they try to call it.Kind of weird of
bun! They add lots ofbun-only extensions themselves, yet they arbitrarily banbunusers from doing so themselves o_O!Hehehe, I'm guessing it's just a side effect of how they implemented it in Zig.
Hi! our team uses bun and unfortunately this is blocking us from updating claude. I was wondering if you might be able to fix it on claude code's side? Thank you soo much!!!
The fix for this will be part of the Bun v1.2.18 release
Fixed by https://github.com/oven-sh/bun/pull/20789 addressing https://github.com/oven-sh/bun/issues/20753!
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.