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

Closed
opened 2026-02-16 17:29:26 -05:00 by yindo · 10 comments
Owner

Originally created by @jordyvandomselaar on GitHub (Aug 3, 2025).

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.

Originally created by @jordyvandomselaar on GitHub (Aug 3, 2025). 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.
yindo closed this issue 2026-02-16 17:29:26 -05:00
Author
Owner

@jordyvandomselaar commented on GitHub (Aug 3, 2025):

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

@jordyvandomselaar commented on GitHub (Aug 3, 2025): `bun run dev` works fine. I'll use that instead.
Author
Owner

@schneiderlo commented on GitHub (Aug 6, 2025):

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

@schneiderlo commented on GitHub (Aug 6, 2025): 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`
Author
Owner

@BSteffaniak commented on GitHub (Aug 6, 2025):

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: ae6e47bb

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

@BSteffaniak commented on GitHub (Aug 6, 2025): 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: ae6e47bb So it seems like something in ca031278 broke this functionality for me.
Author
Owner

@schneiderlo commented on GitHub (Aug 6, 2025):

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
@schneiderlo commented on GitHub (Aug 6, 2025): 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 ```
Author
Owner

@BSteffaniak commented on GitHub (Aug 6, 2025):

@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

@BSteffaniak commented on GitHub (Aug 6, 2025): @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
Author
Owner

@BSteffaniak commented on GitHub (Aug 6, 2025):

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

@BSteffaniak commented on GitHub (Aug 6, 2025): Looks like the readme was _just_ updated to reference using `bun dev`, so my above comment can be disregarded.
Author
Owner

@rekram1-node commented on GitHub (Aug 6, 2025):

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

@rekram1-node commented on GitHub (Aug 6, 2025): Haha yeah I saw your comment and updated it lol @BSteffaniak
Author
Owner

@schneiderlo commented on GitHub (Aug 6, 2025):

What about bun test?

@schneiderlo commented on GitHub (Aug 6, 2025): What about bun test?
Author
Owner

@rekram1-node commented on GitHub (Aug 6, 2025):

just do bun test --conditions=development

@rekram1-node commented on GitHub (Aug 6, 2025): just do `bun test --conditions=development`
Author
Owner

@schneiderlo commented on GitHub (Aug 6, 2025):

Works like a charm thank you! :)

@schneiderlo commented on GitHub (Aug 6, 2025): Works like a charm thank you! :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1090