Repository navigation
Closed as duplicate
Labels
Description
Description
I updated opencode with opencode upgrade --major, now it cannot be opened anymore.
> opencode
ResourceUnavailable: C:\nvm4w\nodejs\opencode.ps1:14:3
Line |
14 | & "$basedir/node_modules/@opencode/cli/bin/opencode.exe" $args
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Program 'opencode.exe' failed to run: An error occurred
| trying to start process
| 'C:\nvm4w\nodejs\node_modules\@opencode\cli\bin\opencode.exe' with working directory 'D:\Repositories\eslint-base-config'. The specified executable is not a valid application for this OS platform.At C:\nvm4w\nodejs\opencode.ps1:14 char:3 + & "$basedir/node_modules/@opencode/cli/bin/opencode.exe" $args + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
Plugins
no plugin
OpenCode version
2.2.0
Steps to reproduce
Dell ~/eslint-base-config
❯ npm un -g @opencode/cli
removed 3 packages in 2s
Dell ~/eslint-base-config
❯ npm install -g @opencode/cli@latest
added 3 packages in 17s
npm warn install-scripts 1 package had install scripts blocked because they are not covered by allowScripts:
npm warn install-scripts @opencode/[email protected] (postinstall: node ./postinstall.mjs)
npm warn install-scripts
npm warn install-scripts Run `npm install -g --allow-scripts=@opencode/cli` to allow these scripts once, or `npm config set allow-scripts=@opencode/cli --location=user` to allow them for all global installs.
Dell ~/eslint-base-config
❯ opencode
ResourceUnavailable: C:\nvm4w\nodejs\opencode.ps1:14:3
Line |
14 | & "$basedir/node_modules/@opencode/cli/bin/opencode.exe" $args
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Program 'opencode.exe' failed to run: An error occurred
| trying to start process
| 'C:\nvm4w\nodejs\node_modules\@opencode\cli\bin\opencode.exe' with working directory 'D:\Repositories\eslint-base-config'. The specified executable is not a valid application for this OS platform.
| At C:\nvm4w\nodejs\opencode.ps1:14 char:3
| + & "$basedir/node_modules/@opencode/cli/bin/opencode.exe" $args
| + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
Dell ~/eslint-base-config
❯ node -v
v24.16.0
Dell ~/eslint-base-config
❯ npm -v
12.2.1
i've tried below too
❯ npm install -g --allow-scripts=@opencode/cli
npm warn install-scripts .npmrc allow-scripts setting is being ignored because --allow-scripts was passed on the command line
added 1 package in 1s
npm warn install-scripts 1 package had install scripts blocked because they are not covered by allowScripts:
npm warn install-scripts @dimaslanjaka/[email protected] (postinstall: node postinstall.cjs; prepare: husky)
npm warn install-scripts
npm warn install-scripts Run `npm install -g --allow-scripts=@dimaslanjaka/eslint-base-config` to allow these scripts once, or `npm config set allow-scripts=@dimaslanjaka/eslint-base-config --location=user` to allow them for all global installs.
Dell ~/eslint-base-config
❯ opencode
ResourceUnavailable: C:\nvm4w\nodejs\opencode.ps1:14:3
Line |
14 | & "$basedir/node_modules/@opencode/cli/bin/opencode.exe" $args
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Program 'opencode.exe' failed to run: An error occurred trying to start process
| 'C:\nvm4w\nodejs\node_modules\@opencode\cli\bin\opencode.exe' with working directory
| 'D:\Repositories\eslint-base-config'. The specified executable is not a valid application for
| this OS platform. At C:\nvm4w\nodejs\opencode.ps1:14 char:3
| + & "$basedir/node_modules/@opencode/cli/bin/opencode.exe" $args
| + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
Screenshot
Operating System
Windows 10
Terminal
Powershell 7
Activity
opencodejr commentedon Oct 28, 2026
Thanks for the detailed report! I think this is a duplicate of #48884.
Your output already shows the cause: npm 12 blocked
@opencode/cli'spostinstallscript (install scripts blocked because they are not covered by allowScripts). That script replaces the placeholderbin/opencode.exewith the real Windows binary. Because it didn't run, Windows reports "not a valid application for this OS platform".Possible duplicates and related issues, ordered from most to least likely:
@opencode/clifails to run when install scripts are disabled (npm 12allowScripts), which leaves the stub binary in place. This matches your freshnpm install -g.opencode upgradewith npm 12 doesn't allow the postinstall script, sobin/opencode.exeis left as the stub on Windows. This matches how it first broke for you withopencode upgrade --major.opencode upgrade, closed as a duplicate of npm 12 upgrade leaves the Windows executable stub #51553.Until this is fixed, either of these should get you running again, as npm's warning suggests:
or run the skipped script yourself in the installed package:
cd C:\nvm4w\nodejs\node_modules\@opencode\cli node postinstall.mjsThe bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different. Please follow #48884 and #51553 for progress.
dimaslanjaka commentedon Oct 28, 2026
fixed by
opencodejr commentedon Oct 29, 2026
No reply in the last day, so I'm closing this as a duplicate of #48884. That issue covers the same problem: npm 12 blocks
@opencode/cli'spostinstall, sobin/opencode.exestays a placeholder and Windows refuses to run it. Theopencode upgradecase that first broke this for you is tracked in #51553. Please follow those two for progress.Until it's fixed, reinstalling with
npm install -g --allow-scripts=@opencode/cli @opencode/cli@latestshould work. So should runningnode postinstall.mjsinsideC:\nvm4w\nodejs\node_modules\@opencode\cli. If your problem turns out to be different, reply here and we can reopen it. Thanks for the report!