v2.1.97 crashes on Linux x64 with Bun CommonJS module error

Resolved 💬 2 comments Opened Apr 9, 2026 by mverrilli Closed Apr 10, 2026

Description

Claude Code v2.1.97 fails to start on Linux x64 with a TypeError: Expected CommonJS module to have a function wrapper error from the embedded Bun runtime. v2.1.96 works fine.

Steps to reproduce

/home/$USER/.local/share/claude/versions/2.1.97 --version

Error output

 6 |     "use strict";
 7 |
 8 |     //
 9 |     if (entry.instantiate)
10 |         return entry.instantiate;
11 |     var instantiatePromise = (async () => {
                                               ^
TypeError: Expected CommonJS module to have a function wrapper. If you weren't messing around with Bun's internals, this is a bug in Bun

Bun v1.3.11 (Linux x64 baseline)

Analysis

  • Both v2.1.96 and v2.1.97 embed Bun v1.3.11, but different builds (different commit hashes):
  • v2.1.96: Bun v1.3.11 (6f0a17c3)
  • v2.1.97: Bun v1.3.11 (87b3dff3)
  • The v2.1.97 Bun build (87b3dff3) has a regression in CommonJS module loading within standalone compiled binaries.
  • The underlying cli.js from the npm package works perfectly when run via Node: node cli.js --version2.1.97 (Claude Code)
  • No environment variable (BUN_JSC_useJIT=0, BUN_RUNTIME_TRANSPILER_CACHE_PATH=0, BUN_CONFIG_NO_MACROS=true, etc.) resolves the issue.
  • Dynamic library dependencies are identical between the two versions.

Workaround

Extract cli.js from the npm package and run it via Node instead of the compiled Bun binary:

# Download and extract the npm package
cd /tmp && npm pack @anthropic-ai/claude-code@2.1.97
tar xf anthropic-ai-claude-code-2.1.97.tgz

# Set up a Node-based installation
mkdir -p ~/.local/share/claude/node-versions/2.1.97
cp package/cli.js ~/.local/share/claude/node-versions/2.1.97/
cp -r package/vendor ~/.local/share/claude/node-versions/2.1.97/
echo '{"type": "module"}' > ~/.local/share/claude/node-versions/2.1.97/package.json

# Create a wrapper script
cat > ~/.local/share/claude/node-versions/2.1.97/claude-wrapper.sh << 'WRAPPER'
#!/usr/bin/env bash
exec node ~/.local/share/claude/node-versions/2.1.97/cli.js "$@"
WRAPPER
chmod +x ~/.local/share/claude/node-versions/2.1.97/claude-wrapper.sh

# Point the symlink to the wrapper
ln -sf ~/.local/share/claude/node-versions/2.1.97/claude-wrapper.sh ~/.local/bin/claude

Environment

  • OS: Ubuntu 24.04.3 LTS (Noble Numbat)
  • Kernel: 6.17.0-19-generic x86_64
  • glibc: 2.39
  • CPU: x86_64 with AVX2 support
  • Node: v25.9.0
  • Working version: 2.1.96 (same Bun v1.3.11 but commit 6f0a17c3)
  • Broken version: 2.1.97 (Bun v1.3.11 commit 87b3dff3)

View original on GitHub ↗

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