Skip to content

createOpencode function failure on Windows due to spawn usage #18792

@webuilder

Description

@webuilder

Description

When I use opencode sdk on windows. I called createOpencode function, then got a fail

node:internal/child_process:286
      const err = new ErrnoException(exitCode, syscall);
                  ^

Error: spawn opencode ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:89:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn opencode',
  path: 'opencode',
  spawnargs: [ 'serve', '--hostname=127.0.0.1', '--port=0' ]
}

Plugins

No response

OpenCode version

1.2.27

Steps to reproduce

Run following on windows 11, then got error.

const { createOpencode } = await import('@opencode-ai/sdk');

const opencode = createOpencode({
    port: 4000,
});

Screenshot and/or share link

Image

Operating System

Windows 11

Terminal

Power shell

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)windows

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions