From be4b7510918de61209a783f884600c2fa39dba96 Mon Sep 17 00:00:00 2001 From: Sahil Bansal Date: Tue, 31 Mar 2026 15:05:37 +0530 Subject: [PATCH] fix: Use PowerShell Expand-Archive for zip extraction on Windows (#190) The npm postinstall script used `unzip` to extract .zip archives, but `unzip` is not available by default on Windows, causing installation to fail with a `spawn UNKNOWN` error. Use PowerShell's `Expand-Archive` on Windows instead, which is available since PowerShell 5.0 (Windows 10+). Fixes #187 Co-authored-by: Claude Opus 4.6 --- publish/npm/install.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/publish/npm/install.js b/publish/npm/install.js index 9c48113..8adbc87 100644 --- a/publish/npm/install.js +++ b/publish/npm/install.js @@ -109,7 +109,16 @@ function extractArchive(archivePath, extractDir) { const isZip = archivePath.endsWith(".zip"); if (isZip) { - execSync(`unzip -o "${archivePath}" -d "${extractDir}"`, { stdio: "pipe" }); + if (process.platform === "win32") { + execSync( + `powershell -NoProfile -Command "Expand-Archive -Force -Path '${archivePath}' -DestinationPath '${extractDir}'"`, + { stdio: "pipe" }, + ); + } else { + execSync(`unzip -o "${archivePath}" -d "${extractDir}"`, { + stdio: "pipe", + }); + } } else { execSync(`tar -xzf "${archivePath}" -C "${extractDir}"`, { stdio: "pipe" }); }