remote-control fails on Windows with nvm4w: node.exe bad option --sdk-url
Bug Description
claude remote-control fails immediately after connecting on Windows with nvm4w (Node Version Manager for Windows). The child process is spawned as node.exe --sdk-url <session_id> instead of node.exe cli.js --sdk-url <session_id>, causing Node.js to reject --sdk-url as an unknown flag.
Environment
- OS: Windows 11 Pro (10.0.26200)
- Claude Code: v2.1.56
- Node.js: v22.17.0 (via nvm4w at
C:\nvm4w\nodejs\node.exe) - Shell: PowerShell / Git Bash
- Plan: Max (subscriptionType: "max")
- Auth: claude.ai (firstParty)
Steps to Reproduce
- Install Claude Code globally via npm on Windows with nvm4w
- Run
claude remote-controlorclaude remote-control --verbose
Error Output
PS C:\Users\ksh12> claude remote-control --verbose
Remote Control v2.1.56
Max concurrent sessions: 1
Environment ID: env_013DcnMHyuR1ki6Xjj9ML2Ec
[18:59:57] Session started: "Session session_01GaSmA1u3G7PWH6Q3JrP5Hy" (session_01GaSmA1u3G7PWH6Q3JrP5Hy)
[18:59:57] Debug log: C:\Users\ksh12\AppData\Local\Temp\claude\bridge-session-session_01GaSmA1u3G7PWH6Q3JrP5Hy.log
·✔︎· Connected · ksh12 · HEAD
[18:59:58] Session failed: C:\nvm4w\nodejs\node.exe: bad option: --sdk-url session_01GaSmA1u3G7PWH6Q3JrP5Hy
[18:59:58] To reconnect: claude --resume session_01GaSmA1u3G7PWH6Q3JrP5Hy
[18:59:58] Failed to archive session session_01GaSmA1u3G7PWH6Q3JrP5Hy: Not Found
[19:00:08] Failed to stop work work_01GaSmA1u3G7PWH6Q3JrP5Hy (attempt 1/3), retrying in 872ms: timeout of 10000ms exceeded
[19:00:09] Environment deregistered.
[19:00:09] Environment offline.
Root Cause Analysis
The claude executable on nvm4w is a shell wrapper script:
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')")
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/node_modules/@anthropic-ai/claude-code/cli.js" "$@"
else
exec node "$basedir/node_modules/@anthropic-ai/claude-code/cli.js" "$@"
fi
When remote-control spawns a child process for the bridge session, it appears to use process.execPath (C:\nvm4w\nodejs\node.exe) directly with --sdk-url as an argument, rather than going through the wrapper script or including cli.js in the arguments. This causes Node.js to interpret --sdk-url as a Node.js runtime flag, which it doesn't recognize.
Expected spawn: node.exe <path>/cli.js --sdk-url <session_id>
Actual spawn: node.exe --sdk-url <session_id>
Additional Context
- Without
--verbose, the error is the same but with less context - First attempt showed "Error: Remote Control is not enabled for your account" (before setting remote-env)
- After configuring remote-env, the session connects successfully but fails when spawning the bridge subprocess
- The session starts and connects (
✔︎ Connected) before failing, suggesting the issue is specifically in subprocess spawning
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗