Skip to content

Cannot find module '@opencode-ai/sdk' on clean repo clone when running bun run packages/opencode/src/index after bun install #1579

Closed

Description

@jordyvandomselaar

I've cloned the repository because I'd like to contribute. Following the readme, I ran

  1. bun install
  2. bun run packages/opencode/src/index

Unfortunately this throws the following error:

error: Cannot find module '@opencode-ai/sdk' from '/Volumes/workspaceCS/personal/opencode/packages/opencode/src/plugin/index.ts'

Which is odd because I can hyper click on "@opencode-ai/sdk" and it jumps to it just fine.

Activity

  1. jordyvandomselaar commented on Aug 3, 2025

    @jordyvandomselaar
    Author

    bun run dev works fine. I'll use that instead.

  2. schneiderlo commented on Aug 6, 2025

    @schneiderlo

    I tried with bun run dev but go the same error:

    ~/workspace/agents/opencode$ bun run dev
    $ bun run --conditions=development packages/opencode/src/index.ts
    
       █▀▀█ █▀▀█ █▀▀ █▀▀▄ █▀▀ █▀▀█ █▀▀▄ █▀▀
       █░░█ █░░█ █▀▀ █░░█ █░░ █░░█ █░░█ █▀▀
       ▀▀▀▀ █▀▀▀ ▀▀▀ ▀  ▀ ▀▀▀ ▀▀▀▀ ▀▀▀  ▀▀▀
    error: Cannot find module '@opencode-ai/sdk' from '/home/lschneid/workspace/agents/opencode/packages/opencode/src/plugin/index.ts'
    
    Bun v1.2.19 (Linux x64)
    

    It was after a fresh clone and bun install

  3. BSteffaniak commented on Aug 6, 2025

    @BSteffaniak
    Sponsor

    Running into this recently as well. I have previously been able to run via bun run packages/opencode/src/index.ts without a problem until pulling in the more recent updates.

    This is the most recent commit that works for me: ae6e47b

    So it seems like something in ca03127 broke this functionality for me.

  4. schneiderlo commented on Aug 6, 2025

    @schneiderlo

    Yes, while running bun test it fails with "error: Cannot find module '@opencode-ai/sdk' from '/home/lschneid/workspace/agents/opencode/packages/opencode/src/plugin/index.ts'"

    For the bun run dev, creating a symlink solved the issue (not for the test though):

    mkdir -p ./node_modules/@opencode-ai
    ln -sf ../../packages/sdk/js ./node_modules/@opencode-ai/sdk
    ln -sf ../../packages/plugin ./node_modules/@opencode-ai/plugin
    
  5. BSteffaniak commented on Aug 6, 2025

    @BSteffaniak
    Sponsor

    @jordyvandomselaar can you reopen this issue? I would expect the instructions in the readme to work. Whether that be updating the readme or fixing the bun run ... command

  6. BSteffaniak commented on Aug 6, 2025

    @BSteffaniak
    Sponsor

    Looks like the readme was just updated to reference using bun dev, so my above comment can be disregarded.

  7. rekram1-node commented on Aug 6, 2025

    @rekram1-node
    Collaborator

    Haha yeah I saw your comment and updated it lol @BSteffaniak

  8. schneiderlo commented on Aug 6, 2025

    @schneiderlo

    What about bun test?

  9. rekram1-node commented on Aug 6, 2025

    @rekram1-node
    Collaborator

    just do bun test --conditions=development

  10. schneiderlo commented on Aug 6, 2025

    @schneiderlo

    Works like a charm thank you! :)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions