pnpm install causes crash
Description
$ opencode
/home/agladysh/. local/share/pnpm/global/5/-pnpm/[email protected]/node_modules/opencode-linux-ar
m64/bin/opencode: 1
ELF
SyntaxError: Invalid or unexpected token
at wrapSafe (node: internal/modules/cjs/loader: 1378:20)
at Module._compile (node: internal/modules/cjs/loader: 1428:41)
at Module,_extensions..js (node: internal/modules/cjs/loader: 1548:10)
at Module. load (node: internal/modules/cjs/loader: 1288:32) at Module._load (node: internal/modules/cjs/loader:1104:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:173:12)
at node: internal/main/run_main_module: 28:49
Node-js v20.18.1
$ uname -a
Linux THAI-1 6.17.4-orbstack-00308-g195e9689a04f #1 SMP PREEMPT Fri Oct 24
64 aarch64 GNU/Linux
07:22:34 UTC 2025 aarch64 aarch
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:
Ubuntu
25.04
Release:
25.04
Codename:
plucky
$ pnpm --version
10.20.0
OpenCode version
1.0.72
Steps to reproduce
- Install Ubuntu 25.04 server VM (Host is OS X 15.6, OrbStack 2.0.4), install nodejs, npm, pnpm via npm.
pnpm i -g opencode-aipnpm approve-builds -g, select and approve opencode- Launching
opencodeleads to crash
Screenshot and/or share link
No response
Operating System
Ubuntu 25.04 (VM in the OS X 15.6 host)
Terminal
Stock OS X Terminal.app
hmm ill check it out
The issue appears to stem from the entrypoint shell script attempting to run a binary with Node.js. As a workaround, I modified lines 18 and 20 of ~/.local/share/pnpm/opencode, removing node from the command and running the binary directly.
Interestingly, reinstalling with pnpm worked without the need to modify the shell script (OpenCode version 1.0.110).
Same here on MacOS and pnpm. opencode 1.0.122. These lines aren't right:
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/global/5/.pnpm/[email protected]/node_modules/opencode-ai/bin/opencode" "$@"
else
exec node "$basedir/global/5/.pnpm/[email protected]/node_modules/opencode-ai/bin/opencode" "$@"
fi
Another one here, In my case was that it was deleted from the system I couldn't find opencode then I reinstalled it like @wgumenyuk did but it didn't work... and run into the same problem it seems the script is trying to call a binary hence the ELF error so we need to test for ELF or JS and exec accordingly
so by removing **node ** from this line (20)
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/global/5/.pnpm/[email protected]/node_modules/opencode-ai/bin/opencode" "$@"
else
**exec node "$basedir/global/5/.pnpm/[email protected]/node_modules/opencode-ai/bin/opencode" "$@"**
fi
and just using
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/global/5/.pnpm/[email protected]/node_modules/opencode-ai/bin/opencode" "$@"
else
**exec "$basedir/global/5/.pnpm/[email protected]/node_modules/opencode-ai/bin/opencode" "$@"**
fi