claude-code - 💡(How to fix) Fix [BUG] v2.1.117 postinstall on macOS arm64 produces `claude.exe` (wrong filename), breaks `claude` command [1 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#52107Fetched 2026-04-23 07:36:26
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×4

Error Message

…and claude (the wrapper) just prints error: An unknown error occurred (Unexpected) with no further detail, even with --debug.

Error Messages/Logs

  1. Observe: error: An unknown error occurred (Unexpected)

Root Cause

Because of the .exe extension, Node's launcher fails with:

Fix Action

Fix / Workaround

Workaround: rename claude.execlaude in the bin directory, OR install via the curl-based native installer (https://claude.ai/install.sh) which bypasses npm entirely.

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

After installing @anthropic-ai/[email protected] 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

  1. macOS Apple Silicon, Node v22.14.0 via nvm, npm 11.11.0
  2. Run: npm install -g @anthropic-ai/claude-code (resolves to 2.1.117)
  3. Run: claude --version
  4. Observe: error: An unknown error occurred (Unexpected)
  5. Run directly: node $(which claude) --version
  6. Observe: ERR_UNKNOWN_FILE_EXTENSION ".exe"
  7. Inspect: ls /path/to/node_modules/@anthropic-ai/claude-code/bin/ → only claude.exe exists, no claude

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.execlaude 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.

extent analysis

TL;DR

The issue can be fixed by renaming the claude.exe binary to claude in the bin directory or by installing via the curl-based native installer.

Guidance

  • The postinstall script in @anthropic-ai/claude-code version 2.1.117 is incorrectly naming the binary as claude.exe on macOS, which should be claude.
  • To verify the issue, check the filename of the binary in the node_modules/@anthropic-ai/claude-code/bin/ directory.
  • A temporary workaround is to manually rename the claude.exe file to claude in the bin directory.
  • Another workaround is to install @anthropic-ai/claude-code using the curl-based native installer, which bypasses npm entirely.

Example

No code snippet is necessary for this issue, as it is a matter of incorrect filename extension.

Notes

The issue is specific to macOS (Apple Silicon) and @anthropic-ai/claude-code version 2.1.117. The problem does not occur when installing via the curl-based native installer.

Recommendation

Apply the workaround by renaming claude.exe to claude in the bin directory, as this is a simple and effective solution to the problem.

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