You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Windows, opencode upgrade fails to detect the installation method and returns "unknown". This causes the upgrade command to show:
x opencode is installed to C:\Users\...\opencode-windows-x64\bin\opencode.exe and may be managed by a package manager
o Install anyways?
| No
Instead of detecting the correct method (e.g. npm) and proceeding with the upgrade.
Root cause: Installation.method() in src/installation/index.ts uses Process.text() which calls child_process.spawn() to run commands like npm list -g. On Windows, npm is actually npm.cmd (a .cmd batch file). child_process.spawn() without shell: true cannot resolve .cmd/.bat files, so every detection command silently fails (returns empty output due to nothrow: true), and method() falls through to "unknown".
The same issue affects all Windows package managers that use .cmd wrappers: npm, pnpm, bun.
Fix: Pass shell: process.env.ComSpec || "cmd.exe" (or shell: true) on Windows when spawning detection and upgrade commands. The path-based fallback detection (checking exec.includes("node_modules")) partially mitigates but does not cover all installation paths.
Plugins
No response
OpenCode version
1.2.25
Steps to reproduce
Install opencode on Windows via npm: npm install -g opencode-ai
Run opencode upgrade
Observe error message about "may be managed by a package manager" instead of detecting npm as the method
Screenshot and/or share link
PS C:\Users\ravi.guntakala> opencode upgrade
▄
█▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█
█ █ █ █ █▀▀▀ █ █ █ █ █ █ █ █▀▀▀
▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀
T Upgrade
|
x opencode is installed to C:\Users\ravi.guntakala\AppData\Roaming\npm\node_modules\opencode-ai\node_modules\opencode-windows-x64\bin\opencode.exe and may be managed by a package manager
|
o Install anyways?
| No
|
— Done
Additional context: this regression was introduced by PR #16286 (refactor(opencode): replace Bun shell in core flows, merged 2026-03-09), which replaced Bun's $ shell template (which resolves .cmd files through the system shell) with Process.spawn() (Node.js child_process.spawn) without shell: true.
Note that this also affects Installation.upgrade() — even if method() were fixed, Process.run(["npm", "install", "-g", ...]) would still fail for the same reason.
Activity
github-actions commentedon Mar 13, 2026
This issue might be a duplicate of existing issues. Please check:
.cmdwrappers not being resolved bychild_process.spawnwithoutshell: true), though that issue manifests at startup rather than during upgrade.fix(cli): resolve Windows upgrade by routing commands through shell
nonoDamn commentedon Mar 16, 2026
+1
denprog5 commentedon Mar 16, 2026
same
amr616d720a0a-rgb commentedon Mar 17, 2026
use npm update -g opencode-ai it solves the problem
lazyalex616 commentedon Mar 18, 2026
Additional context: this regression was introduced by PR #16286 (
refactor(opencode): replace Bun shell in core flows, merged 2026-03-09), which replaced Bun's$shell template (which resolves.cmdfiles through the system shell) withProcess.spawn()(Node.jschild_process.spawn) withoutshell: true.Note that this also affects
Installation.upgrade()— even ifmethod()were fixed,Process.run(["npm", "install", "-g", ...])would still fail for the same reason.feat(settings): self-update first chain, switch hermes to native inst…
feat(settings): self-update first chain, switch hermes to native inst…
feat(settings): self-update first chain, switch hermes to native inst…
feat(settings): self-update first chain, switch hermes to native inst…
feat(settings): self-update first chain, switch hermes to native inst…
feat(settings): self-update first chain, switch hermes to native inst…
feat(settings): self-update first chain, switch hermes to native inst…