Windows: first-run binary download fails to extract when GNU tar (Git for Windows) shadows bsdtar
Summary
On Windows, the first-run download of the native binary fails to extract whenever the tar resolved from PATH is GNU tar (the one Git for Windows puts in C:\Program Files\Git\usr\bin) instead of Windows' bundled bsdtar. The launcher passes an absolute C:\... path to tar, which GNU tar interprets as a remote host, and GNU tar cannot read .zip archives at all.
Result: crw-mcp is unusable on a clean machine until the binary is placed by hand.
Environment
- Windows 11 x64, Node v26.13.0
crw-mcp0.42.1 (bothnpx -y crw-mcpand a global npm install behave the same)- Git for Windows installed; PATH order puts
${GIT}\usr\binbeforeC:\Windows\system32, sotarresolves to GNU tar 1.35 C:\Windows\System32\tar.exe(bsdtar) is present, just shadowed
Reproduction
With no cached binary (%LOCALAPPDATA%\crw-mcp\v0.42.1\crw-mcp.exe absent), just run the server:
node "$(npm root -g)/crw-mcp/bin/crw-mcp.js" --version
Actual behaviour
crw-mcp: downloading crw-mcp-win32-x64.zip (v0.42.1)...
tar: Cannot connect to C: resolve failed
crw-mcp: could not locate or download the win32-x64 binary.
failed to extract crw-mcp-win32-x64.zip (tar exit 128)
Manual install: download crw-mcp-win32-x64.zip from
https://github.com/fastcrw/crw/releases/tag/v0.42.1, check it against SHA256SUMS,
and put crw-mcp.exe in C:\Users\<user>\AppData\Local\crw-mcp\v0.42.1
(or set CRW_MCP_BINARY=/path/to/crw-mcp.exe). HTTPS_PROXY is honoured.
Expected: binary extracted to the cache dir and crw-mcp 0.42.1 printed.
Root cause
In bin/crw-mcp.js (fromDownload):
const tarArgs = plat.asset.endsWith(".zip")
? ["-xf", archive, "-C", stage]
: ["-xzf", archive, "-C", stage];
const x = spawnSync("tar", tarArgs, { stdio: "inherit" });
Two Windows-specific problems combine:
taris resolved throughPATH. With Git for Windows installed, that is GNU tar, which parsesC:\Users\...\archive.zipashost:pathand tries to connect to the hostC:→tar: Cannot connect to C: resolve failed(exit 128).- The
.zipbranch relies on bsdtar's auto-detection. GNU tar cannot read ZIP at all, so even a relative path only changes the error (This does not look like a tar archive), it does not fix it.
Same archive, same arguments, only a different tar:
$ C:\Windows\System32\tar.exe -xf 'C:\TMP\tartest\crw-mcp-win32-x64.zip' -C 'C:\TMP\tartest'
# -> crw-mcp.exe, 28 MB, OK
$ C:\Program Files\Git\usr\bin\tar.exe -xf 'C:\TMP\tartest\crw-mcp-win32-x64.zip' -C 'C:\TMP\tartest'
tar: Cannot connect to C: resolve failed
Suggested fix
On win32, don't rely on PATH for ZIP extraction:
- Prefer the system bsdtar explicitly:
path.join(process.env.SystemRoot, "System32", "tar.exe")(present on Windows 10 17063+), falling back toPATHonly if that file is missing. - Or extract
.zipwithout an external binary, e.g.PowerShell -NoProfile -Command Expand-Archive -Force -LiteralPath ...—powershell.exeis always available on Windows. - Passing a relative archive name with
cwd: stageis worth doing anyway (it makes GNU tar usable for the.tar.gzplatforms), but it is not sufficient for.zipon Windows.
Also worth adding to the failure message: the currently resolved tar path and tar --version first line, so this is diagnosable without digging into PATH.
Workaround (what I did)
Download the matching release asset, verify it against SHA256SUMS, and drop crw-mcp.exe into %LOCALAPPDATA%\crw-mcp\v<version>\ (or point CRW_MCP_BINARY at it). Everything else works normally afterwards.
Found while working around #702 (related only in that both are Windows/local-Chrome papercuts, different root causes).
thanks, great diagnosis. confirmed: the launcher spawns whatever tar is first on PATH with an absolute archive path, so git for windows' gnu tar reads C: as a host and can't open the zip anyway. fixing it to use the system bsdtar on windows and a relative archive name everywhere. will link the pr here.
fixed in #704: on windows the launcher now extracts with the system bsdtar (%SystemRoot%\System32\tar.exe) and passes the archive by its bare name, and a failed extraction says which tar ran. it ships with the next crw-mcp release; until then your manual install keeps working. thanks again for tracking it down.