[BUG] v2.1.117 postinstall on macOS arm64 produces `claude.exe` (wrong filename), breaks `claude` command
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
After installing @anthropic-ai/claude-code@2.1.117 via npm install -g, the binary in node_modules/@anthropic-ai/claude-code/bin/ is created as claude.exe instead of claude on macOS (Apple Silicon).
Because of the .exe extension, Node's launcher fails with:
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".exe" for /Users/<me>/.nvm/versions/node/vXX/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:219:9)
...
…and claude (the wrapper) just prints error: An unknown error occurred (Unexpected) with no further detail, even with --debug.
Confirmed via file:
claude.exe: Mach-O 64-bit executable arm64
So the binary content IS the correct macOS arm64 build — it just has the wrong filename/extension applied by the postinstall script (install.cjs) at v2.1.117.
What Should Happen?
Postinstall should create the platform-correct binary as claude (no extension) on macOS/Linux, and claude.exe only on Windows.
Error Messages/Logs
Steps to Reproduce
- macOS Apple Silicon, Node v22.14.0 via nvm, npm 11.11.0
- Run: npm install -g @anthropic-ai/claude-code (resolves to 2.1.117)
- Run: claude --version
- Observe: error: An unknown error occurred (Unexpected)
- Run directly: node $(which claude) --version
- Observe: ERR_UNKNOWN_FILE_EXTENSION ".exe"
- Inspect: ls /path/to/node_modules/@anthropic-ai/claude-code/bin/ → only
claude.exeexists, noclaude
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.117
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
- OS: macOS (Darwin 25.2.0), Apple Silicon (arm64)
- Node: v22.14.0 (via nvm)
- npm: 11.11.0
- Claude Code: 2.1.117
- Install path: ~/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/
Workaround: rename claude.exe → claude in the bin directory, OR install via the curl-based native installer (https://claude.ai/install.sh) which bypasses npm entirely.
Possible trigger: this was reproduced after installing the deprecated happy-coder npm package, which appears to invoke npm install -g @anthropic-ai/claude-code as part of its setup. But the bug is in claude-code's own install.cjs, not happy-coder.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗