-
Notifications
You must be signed in to change notification settings - Fork 6k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
The postinstall.mjs script creates a symlink from bin/opencode to the native binary on non-Windows platforms. However, the bin/opencode file is a Node.js wrapper script that's designed to locate and execute the platform-specific binary.
When the postinstall script replaces this wrapper with a symlink to the native binary, the system tries to execute the binary using the Node.js shebang (#!/usr/bin/env node), which fails because the binary is a native executable, not a Node.js script.
Plugins
No response
OpenCode version
No response
Steps to reproduce
- Install with pnpm:
$ pnpm add -g opencode-ai WARN 4 deprecated subdependencies found: @koa/[email protected], [email protected], [email protected], [email protected] Packages: +2 ++ Progress: resolved 679, reused 651, downloaded 0, added 0, done
- Start wrapper script
opencodebefore running postinstall script:$ opencode --version 1.13.1
- Run the postinstall script from opencode-ai:
$ pnpm approve-builds -g ✔ Choose which packages to build (Press <space> to select, <a> to toggle all, <i> to invert selection) · opencode-ai ✔ The next packages will now be built: opencode-ai. Do you approve? (y/N) · true .pnpm/[email protected]/node_modules/opencode-ai: Running postinstall script, done in 37ms
- Start wrapper script again:
$ opencode --version /Users/chuck/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/opencode-darwin-arm64/bin/opencode:1 ���� SyntaxError: Invalid or unexpected token at wrapSafe (node:internal/modules/cjs/loader:1638:18) at Module._compile (node:internal/modules/cjs/loader:1680:20) at Object..js (node:internal/modules/cjs/loader:1839:10) at Module.load (node:internal/modules/cjs/loader:1441:32) at Function._load (node:internal/modules/cjs/loader:1263:12) at TracingChannel.traceSync (node:diagnostics_channel:328:14) at wrapModuleLoad (node:internal/modules/cjs/loader:237:24) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5) at node:internal/main/run_main_module:36:49 Node.js v22.21.1
Screenshot and/or share link
No response
Operating System
macOS 26.3
Terminal
Ghostty
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working