Skip to content

opencode v2 (npm) error launch on windows #59796

Closed as duplicate
Closed as duplicate

Description

@dimaslanjaka

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

Image

Operating System

Windows 10

Terminal

Powershell 7

Activity

  1. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report! I think this is a duplicate of #48884.

    Your output already shows the cause: npm 12 blocked @opencode/cli's postinstall script (install scripts blocked because they are not covered by allowScripts). That script replaces the placeholder bin/opencode.exe with 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:

    Until this is fixed, either of these should get you running again, as npm's warning suggests:

    npm install -g --allow-scripts=@opencode/cli @opencode/cli@latest

    or run the skipped script yourself in the installed package:

    cd C:\nvm4w\nodejs\node_modules\@opencode\cli
    node postinstall.mjs

    The 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.

  2. dimaslanjaka commented on Oct 28, 2026

    @dimaslanjaka
    Author

    fixed by

    npm uninstall -g @opencode/cli
    npm uninstall -g opencode-ai
    npm i -g opencode-ai
    
  3. opencodejr commented on Oct 29, 2026

    @opencodejr
    Contributor

    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's postinstall, so bin/opencode.exe stays a placeholder and Windows refuses to run it. The opencode upgrade case 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@latest should work. So should running node postinstall.mjs inside C:\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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions