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.
This commit is contained in:
parent
07e34e3423
commit
604c2d9919
@ -116,7 +116,15 @@ if (!shouldBuild()) {
|
|||||||
} else {
|
} else {
|
||||||
logRunner("Building TypeScript (dist is stale).");
|
logRunner("Building TypeScript (dist is stale).");
|
||||||
const pnpmArgs = ["exec", compiler, ...projectArgs];
|
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 =
|
const buildArgs =
|
||||||
process.platform === "win32" ? ["/d", "/s", "/c", "pnpm", ...pnpmArgs] : pnpmArgs;
|
process.platform === "win32" ? ["/d", "/s", "/c", "pnpm", ...pnpmArgs] : pnpmArgs;
|
||||||
const build = spawn(buildCmd, buildArgs, {
|
const build = spawn(buildCmd, buildArgs, {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user