#keep getting "SyntaxError: Invalid or unexpected token" with pnpm build (latest main pull)

24 messages · Page 1 of 1 (latest)

raw bay
#

rtek99@msi:~/genai/aa/openclaw$ pnpm build

openclaw@2026.4.12 build /home/rtek99/genai/aa/openclaw
node scripts/build-all.mjs

[build-all] canvas:a2ui:bundle
/home/rtek99/.local/share/pnpm/.tools/pnpm-exe/10.32.1/pnpm:1
ELF
^

SyntaxError: Invalid or unexpected token
at wrapSafe (node:internal/modules/cjs/loader:1743:18)
at Module._compile (node:internal/modules/cjs/loader:1786:20)
at Object..js (node:internal/modules/cjs/loader:1943:10)
at Module.load (node:internal/modules/cjs/loader:1533:32)
at Module._load (node:internal/modules/cjs/loader:1335:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)
at node:internal/main/run_main_module:33:47

Node.js v24.14.1
 ELIFECYCLE  Command failed with exit code 1.

thick urchinBOT
vital tapirBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

raw bay
#

ubuntu 24.04

cinder sundialBOT
#

This looks like a real bug in latest main, not just your setup.

build-all.mjs re-runs pnpm through node via scripts/pnpm-runner.mjs. On your machine, npm_execpath seems to be a native pnpm binary:

/home/rtek99/.local/share/pnpm/.tools/pnpm-exe/10.32.1/pnpm

So Node tries to parse an ELF binary as JS, and you get the ELF / SyntaxError.

Quick workaround:

env -u npm_execpath pnpm build

or:

#
npm_execpath='' pnpm build

If you want to confirm, run:

pnpm exec node -p 'process.env.npm_execpath'
file "$(pnpm exec node -p 'process.env.npm_execpath')"

If the unset workaround fixes it, I'd treat this as a bug in main and file it here with that output plus:

openclaw --version
node -v
#

Yep, that fits, this is not a Windows-only thing.

On Ubuntu 24.04, pnpm 10 can expose npm_execpath as a native ELF binary, and OpenClaw's current build runner is mistakenly trying to launch that path with node.

So I'd still try:

env -u npm_execpath pnpm build

If that works, you've basically confirmed it's a bug in scripts/pnpm-runner.mjs.

If you can, post back the result of that command plus:

pnpm -v
#
openclaw --version

Then we can tell whether it's purely the pnpm runner bug or if there's a second issue after that.

raw bay
#

rtek99@msi:~/genai/aa/openclaw$ pnpm --version
10.32.1
rtek99@msi:~/genai/aa/openclaw$ pnpm env list
24.14.1
rtek99@msi:~/genai/aa/openclaw$ node --version
v24.14.1

cinder sundialBOT
#

Thanks, that version combo looks fine. I don't think Ubuntu/Node itself is the problem.

This still points at the nested pnpm runner bug, so the next thing to try is:

env -u npm_execpath pnpm build

or directly:

env -u npm_execpath node scripts/build-all.mjs

Why: pnpm build starts node scripts/build-all.mjs, then that script does another pnpm call for canvas:a2ui:bundle. Right now OpenClaw is grabbing npm_execpath and trying to run the native pnpm ELF through node, which blows up exactly like your trace.

If that works, I'd call it confirmed. If it still fails, paste these too:

#
pnpm exec node -p 'process.env.npm_execpath'
file "$(pnpm exec node -p 'process.env.npm_execpath')"
openclaw --version

We're very close, this looks like a real regression in main.

raw bay
#

rtek99@msi:~/genai/aa/openclaw$ git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

cinder sundialBOT
#

Nice, that helps, clean origin/main means this is probably an upstream regression, not something weird in your checkout.

git status looks good, but the key test is still this one:

env -u npm_execpath pnpm build

If that passes, we’ve basically confirmed the bug.

So at this point I’d want just two things:

env -u npm_execpath pnpm build
openclaw --version
#

If the first command works, I’d report it as: latest main on Ubuntu 24.04 + pnpm 10.32.1 fails because scripts/pnpm-runner.mjs treats a native pnpm ELF as a JS entrypoint.

raw bay
#

rtek99@msi:~/genai/aa/openclaw$ env -u npm_execpath pnpm build

openclaw@2026.4.12 build /home/rtek99/genai/aa/openclaw
node scripts/build-all.mjs

[build-all] canvas:a2ui:bundle
/home/rtek99/.local/share/pnpm/.tools/pnpm-exe/10.32.1/pnpm:1
ELF
^

SyntaxError: Invalid or unexpected token
at wrapSafe (node:internal/modules/cjs/loader:1743:18)
at Module._compile (node:internal/modules/cjs/loader:1786:20)
at Object..js (node:internal/modules/cjs/loader:1943:10)
at Module.load (node:internal/modules/cjs/loader:1533:32)
at Module._load (node:internal/modules/cjs/loader:1335:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)
at node:internal/main/run_main_module:33:47

Node.js v24.14.1
 ELIFECYCLE  Command failed with exit code 1.

cinder sundialBOT
#

Ah, that actually makes sense.

env -u npm_execpath pnpm build still goes through pnpm's lifecycle runner, and pnpm re-injects npm_execpath for the build script. So the bad value comes right back.

Try bypassing the package script entirely:

env -u npm_execpath node scripts/build-all.mjs

If you want to test just the first failing step:

env -u npm_execpath node scripts/bundle-a2ui.mjs

If that works, the bug is even more specifically:

#
  • pnpm sets npm_execpath for lifecycle scripts
  • OpenClaw's scripts/pnpm-runner.mjs assumes that path is JS-runnable via node
  • on your Ubuntu setup it is a native ELF pnpm binary, so Node explodes on ELF

So yeah, still looks like a real regression, just one layer deeper than I first said.

raw bay
#

looks working with "env -u npm_execpath node scripts/build-all.mjs", past last error. thanks

cinder sundialBOT
#

Nice, glad that unblocked it. 🎉

So the short version is: pnpm build is broken there, but this works as a temporary workaround:

env -u npm_execpath node scripts/build-all.mjs

Since you reproduced it on clean main, Ubuntu 24.04, pnpm 10.32.1, I'd file it as a bug here: https://github.com/openclaw/openclaw/issues

Glad that helped! 🎉
If this fixed it, please right-click the solution message → Apps → ✅ Mark Solution.
This helps Answer Overflow index the solution for future users.

raw bay
#

will do

cinder sundialBOT
#

Perfect, thank you. Glad we got you unstuck.

raw bay
#

are you a person, or a bot, just curious