diff --git a/dist/index.js b/dist/index.js index ec942a3..3b5b18c 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/src/install-pnpm/run.ts b/src/install-pnpm/run.ts index 922d79b..e248d0a 100644 --- a/src/install-pnpm/run.ts +++ b/src/install-pnpm/run.ts @@ -29,7 +29,10 @@ export async function runSelfInstaller(inputs: Inputs): Promise { await writeFile(path.join(dest, 'package.json'), packageJson) await writeFile(path.join(dest, 'package-lock.json'), JSON.stringify(lockfile)) - const npmExitCode = await runCommand('npm', ['ci'], { cwd: dest }) + // On Windows, the PATH key casing varies; search case-insensitively. + const pathKey = Object.keys(process.env).find(k => k.toUpperCase() === 'PATH') ?? 'PATH' + const npmEnv = { ...process.env, [pathKey]: path.dirname(process.execPath) + path.delimiter + process.env[pathKey] } + const npmExitCode = await runCommand('npm', ['ci'], { cwd: dest, env: npmEnv }) if (npmExitCode !== 0) { return npmExitCode } @@ -155,10 +158,11 @@ function getSystemNodeVersion(): Promise<{ major: number; minor: number }> { }) } -function runCommand(cmd: string, args: string[], opts: { cwd: string }): Promise { +function runCommand(cmd: string, args: string[], opts: { cwd: string; env?: Record }): Promise { return new Promise((resolve, reject) => { const cp = spawn(cmd, args, { cwd: opts.cwd, + env: opts.env, stdio: ['pipe', 'inherit', 'inherit'], shell: process.platform === 'win32', })