Problem: opencode does not ship a windows-arm64 binary (issue #4340). The npm wrapper detects arm64 and fails with:
It seems that your package manager failed to install the right version of the opencode CLI for your platform.
You can try manually installing "opencode-windows-arm64" package
Solution: Force-install the x64 binary and set OPENCODE_BIN_PATH so the Node.js wrapper uses it directly. Windows 11 arm64 runs x86_64 binaries natively via its built-in emulation layer.
- Windows 11 on arm64 (e.g., Snapdragon X Elite)
- Node.js installed (any architecture — arm64 or x64)
- npm available
npm install -g opencode-ai@latestThis installs the Node.js wrapper but no platform binary (since opencode-windows-arm64 doesn't exist). The opencode command will fail at this point — that's expected.
npm install -g opencode-windows-x64@1.2.24 --forcenpm will warn about EBADPLATFORM (CPU mismatch) without --force. The --force flag overrides the platform check and installs the x64 binary.
Note: Replace
1.2.24with the version from Step 1 if different. The platform package version must match the main package version. Check withnpm list -g opencode-ai.
The binary path depends on your npm global prefix. Find it with:
npm prefix -gDefault (standard Node.js install):
C:\Users\<username>\AppData\Roaming\npm
FNM users: FNM overrides the global prefix to a custom location (e.g., %USERPROFILE%\.local\bin). Use whatever npm prefix -g returns.
The Node.js wrapper reads OPENCODE_BIN_PATH (line 20-23 of bin/opencode) and uses it to locate the binary, bypassing platform detection entirely.
Substitute <npm-prefix> with the output from Step 3:
setx OPENCODE_BIN_PATH "<npm-prefix>\node_modules\opencode-windows-x64\bin\opencode.exe"Example (default npm prefix):
setx OPENCODE_BIN_PATH "%APPDATA%\npm\node_modules\opencode-windows-x64\bin\opencode.exe"Example (FNM):
setx OPENCODE_BIN_PATH "%USERPROFILE%\.local\bin\node_modules\opencode-windows-x64\bin\opencode.exe"Note:
setxsets a persistent user-level environment variable. It does NOT affect the current terminal session. You must open a new terminal (or restart your IDE/editor) for the change to take effect.
Open a new terminal and run:
opencode --versionExpected output:
1.2.24
When upgrading opencode, repeat Steps 1-2 with the new version:
npm install -g opencode-ai@latest
npm install -g opencode-windows-x64@<new-version> --forceOPENCODE_BIN_PATH does not need to change — it points to the same path, which npm overwrites in place.
If opencode segfaults, the issue is arm64 Node.js calling spawnSync on the x64 binary. This happens whenever the Node.js wrapper is invoked instead of the .exe directly — regardless of shell. This is a Node.js bug, not an opencode bug.
Workaround: Invoke the binary directly, bypassing the Node.js wrapper:
& "$(npm prefix -g)\node_modules\opencode-windows-x64\bin\opencode.exe" --versionsetx requires a new process tree. Close all terminals and IDE sessions, then reopen. The variable is set at the user level and inherited by all new processes.
Verify the variable is set:
PowerShell:
$env:OPENCODE_BIN_PATHCMD:
echo %OPENCODE_BIN_PATH%Git Bash:
echo "$OPENCODE_BIN_PATH"If opencode --version shows the old version after upgrading, verify the x64 package was updated:
npm list -g opencode-ai opencode-windows-x64Both should show the same version.
-
Windows 11 arm64 emulation: Windows 11 transparently runs x86_64 binaries on arm64 via its built-in emulation layer. The opencode x64 binary (built with Bun) runs correctly under this emulation.
-
OPENCODE_BIN_PATH: The npm wrapper script (
node_modules/opencode-ai/bin/opencode) checks this env var first (before platform detection) and callsspawnSync(target)with the specified path. This skips theopencode-windows-arm64package lookup entirely. -
Bun upstream: Bun added
bun-windows-arm64support in v1.3.10 (2026-02-26), so a native opencode arm64 binary is technically possible. Once opencode addsopencode-windows-arm64to their build matrix, this workaround becomes unnecessary.
Tested: 2026-03-10 on Windows 11 arm64 (Snapdragon X Elite) with opencode v1.2.24, Node.js arm64