# Bug report: pnpm run build fails with SyntaxError: Invalid or unexpected token when pnpm is installed via mise
#3475
Replies: 1 comment
|
Confirmed against the current rc.8 A bounded recovery is to run the repository with its exact pnpm version through a JavaScript entrypoint, then prove what the nested script sees: corepack prepare pnpm@11.7.0 --activate
corepack pnpm exec node -p "process.env.npm_execpath"
corepack pnpm install --frozen-lockfile
corepack pnpm run buildContinue only when the probe ends in The full symptom matrix, recovery path, affected runners, and regression gates are here: https://sandbaseai.github.io/deepseek-harness-handbook/windows-standalone-pnpm.html Canonical source-backed runbook: https://github.com/sandbaseai/deepseek-harness-handbook/blob/main/docs/en/troubleshooting/windows-standalone-pnpm-npm-execpath.md |
Uh oh!
There was an error while loading. Please reload this page.
Bug report:
pnpm run buildfails withSyntaxError: Invalid or unexpected tokenwhen pnpm is installed via miseSummary
scripts/build.tsassumesprocess.env.npm_execpathis a Node.js script path and feeds it tonode(spawnSync(process.execPath, [packageManager, 'run', script])). When pnpm is installed via mise (or any native installer),npm_execpathpoints to a native Windows executable (pnpm.exe), so node tries to parse the PE binary as JavaScript and fails withSyntaxError: Invalid or unexpected token.Environment
mise installs\pnpm\11.7.0\pnpm.exe, a ~98 MB native executable - no.cjs/.jsvariant present)Repro
Observed output (abridged):
The direct equivalent of what
build.tsdoes:node "C:\Users\root\AppData\Local\mise\installs\pnpm\11.7.0\pnpm.exe" run build:libfails identically, confirming the root cause.
Root cause
scripts/build.ts(runScript):process.execPath->node.exeprocess.env.npm_execpath->...\pnpm\11.7.0\pnpm.exe(a native PE executable)So the actual command executed is
node "pnpm.exe" run build:lib, and node parses the PE header as source ->SyntaxError.This works only when
npm_execpathpoints to a JS/CJS launcher (e.g. npm's ownnpm-cli.js, or pnpm installed as.cjsvianpm i -g pnpm). It breaks for package managers installed as native executables (mise, volta, scoop, etc.).Suggested fix
In
scripts/build.ts, detect whethernpm_execpathis a native executable and spawn it directly instead of vianode:This preserves the existing behavior for JS launchers and fixes native binaries (Windows
.exe; also consider /.(exe|cmd|bat)$/i or a more portable check). Alternatively, resolve the underlying JS entry of the package manager (e.g. viarequire.resolve), but the extension check is the minimal, robust fix.Notes (possibly related)
pnpm --versionin the repo root also warns: "The 'workspaces' field in package.json is not supported by pnpm. Create a 'pnpm-workspace.yaml' file instead." - the repo does havepnpm-workspace.yaml(confirmed present), so this warning may be a separate pnpm/mise quirk worth a look.All reactions