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 <noreply@anthropic.com>
This commit is contained in:
Sahil Bansal
2026-03-31 15:05:37 +05:30
committed by GitHub
co-authored by Claude Opus 4.6
parent 8e563ee5a1
commit be4b751091
+10 -1
View File
@@ -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" });
}