-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Bug
/extensions fails on Windows with:
Extension "command:extensions" error: npm search failed: exit 1
And after attempting to use npm.cmd instead:
command:extensions error: spawn EINVAL
Root Cause
Throughout the extension, pi.exec("npm", ...) (and pi.exec("npm.cmd", ...)) are called in several files:
src/packages/discovery.ts(3 calls)src/packages/install.ts(1 call)src/utils/auto-update.ts(1 call)src/ui/remote.ts(1 call)
On Windows, npm is a shell script and npm.cmd is a batch file — neither can be spawned directly via Node.js child_process.spawn without shell: true. Since pi.exec has no shell option, both approaches fail.
Suggested Fix
Call node directly with the path to npm-cli.js:
import { execPath } from "process"; // node.exe — a real executable
const npmCli = join(dirname(execPath), "node_modules", "npm", "bin", "npm-cli.js");
// then: pi.exec(execPath, [npmCli, "search", ...])C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js is the standard install location, and process.execPath gives the node binary path reliably cross-platform.
Environment
- OS: Windows 11
- pi: 0.54.2
- pi-extmgr: 0.1.22
This issue was identified and filed by Claude running inside pi, not a human.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels