Replies: 4 comments
|
I traced this against rc.8 ( |
|
Hit this same crash on I patched around it locally in const isNativeExecutable = /\.exe$/i.test(packageManager)
const command = isNativeExecutable ? packageManager : process.execPath
const args = isNativeExecutable ? ['run', script] : [packageManager, 'run', script]That's the same idea @banatic already laid out above, just narrower — a single-file, |
|
Try corepack enable |
|
Windows + standalone pnpm 时 如果官方短期修不了,文档里写一句「Windows 请用 npm 发行的 pnpm 或把 |
Uh oh!
There was an error while loading. Please reload this page.
Summary
scripts/build.ts,scripts/run-gates.ts,scripts/run-web-snapshots.tsandscripts/coverage-partitions.tsall assumeprocess.env.npm_execpathpoints at a JS entrypoint and spawn it asnode <npm_execpath> ….With pnpm 11 installed as the standalone build (
@pnpm/exe, i.e. the default for the standalone script /winget/npm i -g @pnpm/exeinstalls),npm_execpathpoints at a native executable instead:Node then tries to ESM-load
pnpm.exeand dies.pnpm run buildfails immediately, and so doescheck:all/check:ci*,test:coverage:partitioned, andtest:web:ci.This is invisible on a JS-entrypoint install (Corepack,
npm i -g pnpm), which is presumably what CI uses, the standalone build is the one the pnpm docs recommend first on Windows.Repro
Environment:
@pnpm/exebuilddeepseek-harness@dsh-v0.1.0-rc.8(141eb6f)Result:
Confirming the environment variable directly (any package script, any directory):
Cause
scripts/build.ts:node <pnpm.exe> run build:libcannot work. The same assumption is repeated in three other places:scripts/build.tsspawnSync(process.execPath, [packageManager, 'run', script], …)scripts/run-gates.ts(pnpmInvocation){ command: process.execPath, args: [entrypoint, ...args] }scripts/run-web-snapshots.tsbaseArgs = [pnpmEntrypoint, 'exec', 'vitest', …]→spawn(process.execPath, args)scripts/coverage-partitions.tsargs: [this.pnpmEntrypoint, 'exec', 'vitest', …]→spawn(process.execPath, command.args, …)The comment in
run-gates.ts("Windows cannot spawn the pnpm.cmd shim directly; the JavaScript entrypoint keeps every host shell-free") shows the intent — staying shell-free — and that intent still holds. It is only the "the entrypoint is always JavaScript" half that no longer does.Suggested fix
Decide how to spawn based on the entrypoint's extension: wrap it in Node when it is
.js/.cjs/.mjs, otherwise spawn the executable directly. Both branches stay shell-free, so the original Windows.cmd-shim problem is still avoided.A shared helper,
scripts/package-manager.ts:The four call sites then become one-liners, e.g. in
scripts/build.ts:CoverageCommandneeds one extracommand: stringfield alongside its existingargs, sincerunCoverageCommandcurrently hardcodesprocess.execPath. On a JS-entrypoint install every resolved command is byte-identical to today's, so CI behaviour is unchanged.Verification
On the environment above, after the change:
pnpm run build→ passes,build: recorded 200 client artifact(s) with 1 public value(s)pnpm run typecheck:contracts-ready→ passesoxlint scripts→ cleanvitest run scripts/coverage-partitions.spec.ts scripts/run-gates.spec.ts→ 67 passed, 1 skippedAll reactions