Description
I am following this instruction: https://github.com/badlogic/lemmy/tree/main/apps/claude-trace
I am encountering a SyntaxError: Invalid or unexpected token when attempting to use claude-trace with the latest version of Claude Code installed via Homebrew.
The issue appears to be caused by the recent transition of Claude Code from a plain Node.js script to a compiled native binary (Mach-O 64-bit on macOS). When claude-trace attempts to execute this binary through Node.js to intercept traffic, Node.js fails to parse the compiled code as JavaScript.
Environment
Claude Code Version: 2.1.50
Install Method: Homebrew (/opt/homebrew/Caskroom/claude-code/)
OS: macOS (Apple Silicon)
Node.js Version: v25.6.1
Error Logs in Claude Code
(/opt/homebrew/Caskroom/claude-code/2.1.50/claude) through Node.js — and that binary is not a JavaScript file. It's a compiled binary (likely
an Electron/native app), so Node.js fails with Invalid or unexpected token when trying to parse it as JS.
This is a known compatibility issue between claude-trace and the version of Claude Code you have installed. Here's the breakdown:
Root Cause:
- claude-trace works by proxying the Claude Code binary through Node.js to intercept API calls
- Your Claude Code binary at /opt/homebrew/Caskroom/claude-code/2.1.50/claude is a compiled native binary (not a plain JS file), so Node.js
can't execute it directly
This confirms the issue. The Claude binary is a Mach-O 64-bit native binary (a compiled executable for Apple Silicon), not a JavaScript file.
claude-trace was built to work with an older version of Claude Code when it was distributed as a plain Node.js script.
This is a version incompatibility. Starting from newer releases, Claude Code ships as a compiled native binary instead of a JS script,
breaking claude-trace's interception mechanism.
Additional Context
Recently, I noticed that issue #48 seem to address "native binary" support.
Description
I am following this instruction: https://github.com/badlogic/lemmy/tree/main/apps/claude-trace
I am encountering a SyntaxError: Invalid or unexpected token when attempting to use claude-trace with the latest version of Claude Code installed via Homebrew.
The issue appears to be caused by the recent transition of Claude Code from a plain Node.js script to a compiled native binary (Mach-O 64-bit on macOS). When claude-trace attempts to execute this binary through Node.js to intercept traffic, Node.js fails to parse the compiled code as JavaScript.
Environment
Claude Code Version: 2.1.50
Install Method: Homebrew (/opt/homebrew/Caskroom/claude-code/)
OS: macOS (Apple Silicon)
Node.js Version: v25.6.1
Error Logs in Claude Code
Additional Context
Recently, I noticed that issue #48 seem to address "native binary" support.