Skip to content

sharp module fails to install on Windows - memory system stuck in "initializing" #122

@Gi2tHubProtect

Description

@Gi2tHubProtect

Environment

  • OS: Windows 10/11 x64
  • Runtime: Node.js / OpenCode built-in
  • Plugin version: v2.14.3
  • sharp version: 0.34.5
    Problem
    On Windows, the plugin loads successfully and the web UI starts at http://127.0.0.1:4747, but the memory tool always returns "Memory system is initializing." and never becomes ready.
    Log file: ~/.opencode-mem/opencode-mem.log
    Failed to initialize embedding model: {"error":"Error:
    Something went wrong installing the "sharp" module

Cannot find module '../build/Release/sharp-win32-x64.node' from
'C:\Users<user>.cache\opencode\packages\opencode-mem@latest\node_modules\sharp\lib\sharp.js'
Root Cause
sharp is a transitive dependency (via @xenova/transformers). When OpenCode auto-downloads the plugin to ~/.cache/opencode/packages/, the sharp native binary for Windows x64 is not installed correctly. The @img/sharp-win32-x64 optional dependency is not resolved.
Workaround
Manually install the platform-specific binary in the cache directory:
cd ~/.cache/opencode/packages/opencode-mem@latest
npm install @img/sharp-win32-x64
After this, restart OpenCode and the memory system initializes correctly.
Suggestion

  1. Add a Windows installation note in the README (Prerequisites or Getting Started section)
  2. Consider adding @img/sharp-win32-x64 (and other platform binaries) as direct dependencies instead of relying on optional dependency resolution, since OpenCode's plugin loader may skip optional deps
  3. Or handle the sharp initialization failure gracefully with a clearer error message pointing to the fix
    Logs
    --- Session started: 2026-06-05T00:40:07.087Z ---
    [2026-06-05T00:40:07.088Z] Failed to initialize embedding model: {"error":"Error: \nSomething went wrong installing the "sharp" module\n\nCannot find module '../build/Release/sharp-win32-x64.node'"}
    [2026-06-05T00:40:07.092Z] Plugin warmup failed: {"error":"Error: ..."}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions