Repository navigation
fix: resolve bun/pnpm global install failures on Windows - #4275
Conversation
Fixes anomalyco#3363 - `bun install -g opencode-ai` now works on Windows
There was a problem hiding this comment.
Pull Request Overview
This PR fixes bun/pnpm global install failures on Windows by simplifying the installation approach: instead of using complex postinstall scripts to copy binaries, the Windows .exe is now included directly in the published package with the bin field pointing to it.
Key changes:
- Replaced shell commands with Node.js fs APIs for cross-platform compatibility
- Standardized Windows platform naming to "win32" in build configuration
- Simplified Windows postinstall logic to skip setup (binary already packaged)
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/opencode/script/publish.ts | Replaced shell commands with fs APIs; added Windows .exe copying logic; updated process.chdir calls for publishing |
| packages/opencode/script/postinstall.mjs | Removed Windows-specific binary copying and npm wrapper regeneration; Windows now exits early as binary is pre-packaged |
| packages/opencode/script/build.ts | Changed Windows OS identifier from "windows" to "win32" for consistency with process.platform |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| os: "win32", | ||
| arch: "x64", | ||
| }, | ||
| { | ||
| os: "windows", | ||
| os: "win32", |
There was a problem hiding this comment.
The opencode.cmd wrapper script uses platform=windows to construct the package name opencode-windows-x64, but after this change, the Windows packages are now published as opencode-win32-x64. This mismatch will cause the .cmd wrapper to fail to locate the binary package on Windows.
The platform variable in bin/opencode.cmd (line 14) should be changed to win32 to match the new package naming convention.
) Co-authored-by: Aiden Cline <[email protected]>
) Co-authored-by: Aiden Cline <[email protected]>
) Co-authored-by: Aiden Cline <[email protected]>
No description provided.