Skip to content

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

@Vasyl-Shuba

Description

@Vasyl-Shuba

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clibugSomething isn't workingduplicateThis issue or pull request already existshas reproHas detailed reproduction stepsplatform:windowsIssue specifically occurs on WindowsstaleIssue is inactive

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions