Remote Control fails on Windows npm install: node.exe bad option --sdk-url

Resolved 💬 6 comments Opened Feb 25, 2026 by Vasyl-Shuba Closed Mar 27, 2026

Bug Description

claude remote-control fails immediately on Windows when Claude Code is installed via npm.

Error Message

[19:32:37] Session failed: C:\Program Files\nodejs\node.exe: bad option: --sdk-url session_01Ef7TU423PTCPcM2kCyj1uL

Root Cause

The bridge session spawner in cli.js uses process.execPath to spawn child sessions:

spawn(process.execPath, ["--print", "--sdk-url", url, "--session-id", id, ...])

On npm installs, process.execPath is node.exe (not the claude binary). Node.js interprets --print as its own -p flag (evaluate expression), then rejects --sdk-url as an invalid Node.js option.

On standalone binary installs (e.g., Homebrew), process.execPath IS the claude binary, so the flags are parsed correctly by Claude Code.

Environment

  • OS: Windows 11 Pro 10.0.22631
  • Node.js: v22.18.0
  • Claude Code: 2.1.55 (installed via npm install -g @anthropic-ai/claude-code)
  • Shell: PowerShell / Git Bash

Workaround

Patch cli.js to insert process.argv[1] (path to cli.js) as the first spawn argument when running under Node.js:

Replace:

spawn(A.execPath, $, {cwd: K, stdio: ["pipe","pipe","pipe"], env: H, windowsHide: true})

With:

spawn(A.execPath, [...((/node(\.exe)?$/i).test(A.execPath) ? [process.argv[1]] : []), ...$], {cwd: K, stdio: ["pipe","pipe","pipe"], env: H, windowsHide: true})

This makes the spawn equivalent to what the npm shim does: node.exe cli.js --print --sdk-url ...

Suggested Fix

The bridge spawner should account for npm installs where process.execPath is the Node.js binary, not the Claude Code binary. Either include the script path in the spawn args, or resolve the claude command from PATH instead of using process.execPath.

View original on GitHub ↗

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