error: Cannot find module '@opencode-ai/plugin' from #3702

Open
opened 2026-02-16 17:41:09 -05:00 by yindo · 6 comments
Owner

Originally created by @korade-krushna on GitHub (Dec 20, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

Whenever I try to have conversation with opencode this error comes up

error: Cannot find module '@opencode-ai/plugin' from

OpenCode version

running using source code

Steps to reproduce

clone repo
bun install
bun dev
add gemini api key
have conversation with opencode

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Originally created by @korade-krushna on GitHub (Dec 20, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description Whenever I try to have conversation with opencode this error comes up error: Cannot find module '@opencode-ai/plugin' from ### OpenCode version running using source code ### Steps to reproduce clone repo bun install bun dev add gemini api key have conversation with opencode ### Screenshot and/or share link _No response_ ### Operating System _No response_ ### Terminal _No response_
yindo added the bug label 2026-02-16 17:41:09 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 20, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #1579: Cannot find module '@opencode-ai/sdk' on clean repo clone when running bun run packages/opencode/src/index after bun install
  • #1898: Local development flow not working due to new plugin logic

Both issues describe the same root cause: module resolution errors with @opencode-ai/* packages during local development setup (clone repo → bun install → bun dev). The issue appears to be related to plugin logic in packages/opencode/src/plugin/index.ts importing @opencode-ai/sdk which does not resolve without the SDK being built first.

Feel free to ignore if this is a different scenario from these existing issues.

@github-actions[bot] commented on GitHub (Dec 20, 2025): This issue might be a duplicate of existing issues. Please check: - #1579: Cannot find module '@opencode-ai/sdk' on clean repo clone when running bun run packages/opencode/src/index after bun install - #1898: Local development flow not working due to new plugin logic Both issues describe the same root cause: module resolution errors with @opencode-ai/* packages during local development setup (clone repo → bun install → bun dev). The issue appears to be related to plugin logic in packages/opencode/src/plugin/index.ts importing @opencode-ai/sdk which does not resolve without the SDK being built first. Feel free to ignore if this is a different scenario from these existing issues.
Author
Owner

@rekram1-node commented on GitHub (Dec 20, 2025):

can u do

opencode run hello --print-logs

@rekram1-node commented on GitHub (Dec 20, 2025): can u do opencode run hello --print-logs
Author
Owner

@korade-krushna commented on GitHub (Dec 20, 2025):

I'm running this in source code repo of opencode

bun install
bun dev

I have not install opencode yet

@korade-krushna commented on GitHub (Dec 20, 2025): I'm running this in source code repo of opencode bun install bun dev I have not install opencode yet
Author
Owner

@shekohex commented on GitHub (Dec 21, 2025):

Maybe related? https://github.com/shekohex/opencode-google-antigravity-auth/issues/5

@shekohex commented on GitHub (Dec 21, 2025): Maybe related? https://github.com/shekohex/opencode-google-antigravity-auth/issues/5
Author
Owner

@rakibdev commented on GitHub (Dec 21, 2025):

ok found the issue.
i've opencode dotfiles in Downloads. e.g., ~/Downloads/opencode/tool/webfetch.ts
which is symlinked to ~/.config/opencode/...
i bun install node_modules in symlink dir not dotfiles dir. for that reason tool webfetch.ts imports couldn't resolve opencode-ai/plugin

@rakibdev commented on GitHub (Dec 21, 2025): ok found the issue. i've opencode dotfiles in Downloads. e.g., `~/Downloads/opencode/tool/webfetch.ts` which is symlinked to `~/.config/opencode/...` i bun install `node_modules` in symlink dir not dotfiles dir. for that reason tool `webfetch.ts` imports couldn't resolve `opencode-ai/plugin`
Author
Owner

@miouluo commented on GitHub (Feb 11, 2026):

好的,找到了问题所在。我在下载中设置了Opencode点文件。例如,它在 symlink dir 里与 i bun 安装关联,而不是 dotfiles dir。因此工具导入无法解析~/Downloads/opencode/tool/webfetch.ts``~/.config/opencode/...``node_modules``webfetch.ts``opencode-ai/plugin

rm /.config/opencode
export OPENCODE_CONFIG_DIR=
/Downloads/opencode
opencode serve --hostname 0.0.0.0 --port 4096

@miouluo commented on GitHub (Feb 11, 2026): > 好的,找到了问题所在。我在下载中设置了Opencode点文件。例如,它在 symlink dir 里与 i bun 安装关联,而不是 dotfiles dir。因此工具导入无法解析`~/Downloads/opencode/tool/webfetch.ts``~/.config/opencode/...``node_modules``webfetch.ts``opencode-ai/plugin` rm ~/.config/opencode export OPENCODE_CONFIG_DIR=~/Downloads/opencode opencode serve --hostname 0.0.0.0 --port 4096
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3702