To pin a specific version (e.g. 1.14.42), set the OPENCODE_VERSION env var before the build:
Build a specific x64 package version
OPENCODE_VERSION=1.14.42bun./scripts/prepare.ts
bunrunbuild
bunrunpackage:win----x64--publishnever
Follow-up: Native Module Mismatch
After building with --x64, the .exe may launch but crash with:
Follow-up: Native Module Mismatch
Error: Cannot find module './windowsTerminal'
Root cause: bun run build resolves native modules (e.g. @lydell/node-pty) based on the host platform and architecture — darwin-arm64 — rather than the target win32-x64. The bundle ends up importing the macOS native binding, which fails when the Windows .exe tries to load it at runtime.
The Fix
Set RUST_TARGET=x86_64-pc-windows-msvc so the build step selects the correct native bindings for the target platform:
The .exe built on macOS will not be Windows-code-signed. Electron-builder's signing routines typically gate on process.platform === "win32" (and often GITHUB_ACTIONS === "true"), so they intentionally skip signing on macOS. If you need a signed Windows release artifact, you must either build and sign on a Windows machine or add a macOS-compatible signing path to your config.
CLI build
Build the linux x64 cli
bunrunbuild:node--target=linux-x64
opencodeserve--service# to test if thape-config can write