From 604c2d991965f92e946ec5150ff6a6284c1b31ae Mon Sep 17 00:00:00 2001 From: elliotsecops Date: Tue, 27 Jan 2026 18:22:50 -0400 Subject: [PATCH] fix(scripts): use local pnpm binary in run-node.mjs if global is missing Allows the gateway to bootstrap in restricted environments where global packages cannot be installed or are not in the PATH. Checks for node_modules/.bin/pnpm before failing. --- scripts/run-node.mjs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/run-node.mjs b/scripts/run-node.mjs index dcb40dcbf..beaf9d0b3 100644 --- a/scripts/run-node.mjs +++ b/scripts/run-node.mjs @@ -116,7 +116,15 @@ if (!shouldBuild()) { } else { logRunner("Building TypeScript (dist is stale)."); const pnpmArgs = ["exec", compiler, ...projectArgs]; - const buildCmd = process.platform === "win32" ? "cmd.exe" : "pnpm"; + + // PR Fix: Check for local pnpm binary if global might be missing + let pnpmCmd = "pnpm"; + const localPnpm = path.join(cwd, "node_modules", ".bin", process.platform === "win32" ? "pnpm.cmd" : "pnpm"); + if (fs.existsSync(localPnpm)) { + pnpmCmd = localPnpm; + } + + const buildCmd = process.platform === "win32" ? "cmd.exe" : pnpmCmd; const buildArgs = process.platform === "win32" ? ["/d", "/s", "/c", "pnpm", ...pnpmArgs] : pnpmArgs; const build = spawn(buildCmd, buildArgs, {