sharp fails to load: missing trustedDependencies in package.json

Open Beginner friendly
#24 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
bun
Domain
tooling

Research direction

Open plugins/macrodata/package.json and inspect its dependency configuration, then read Bun's trustedDependencies behavior. Run bun install in the plugin and verify that sharp's native binary is available so the search_memory tool loads successfully on the reported environment.

Written by the indexing model from the issue text.

Description

Problem

search_memory (and any tool that triggers @xenova/transformerssharp) fails with:

Cannot find module '../build/Release/sharp-darwin-arm64v8.node'
from '/Users/.../.bun/install/cache/sharp@0.32.6@@@1/lib/sharp.js'

This happens because sharp@0.32.6 has a postinstall script that compiles/downloads the native binary, but bun skips postinstall scripts by default unless the package is listed in trustedDependencies.

Since macrodata uses bun as its runtime and package manager, the native binary is never built, and sharp fails at runtime.

Fix

Add trustedDependencies to plugins/macrodata/package.json:

"trustedDependencies": [
  "sharp"
]

Then bun install will run sharp's install script and the native binary will be available.

Workaround

Until this is fixed upstream, users can manually patch their cached copy:

# Find the cached plugin
cd ~/.claude/plugins/cache/macrodata/macrodata/<version>/

# Add trustedDependencies to package.json (before devDependencies)
# "trustedDependencies": ["sharp"]

# Reinstall
rm -rf node_modules/sharp
bun install

# May also need to copy the binary to bun's global cache:
mkdir -p ~/.bun/install/cache/sharp@0.32.6@@@1/build/Release
cp node_modules/sharp/build/Release/sharp-darwin-arm64v8.node \
   ~/.bun/install/cache/sharp@0.32.6@@@1/build/Release/

# Restart Claude Code to reload the MCP server

Environment

  • macOS (darwin-arm64)
  • bun 1.3.9
  • macrodata 0.1.3
  • sharp 0.32.6 (transitive via @xenova/transformers)
Dominant language
TypeScript
Stars
119
Forks
6
Avg merge
1h 32m
Merged PRs (30d)
2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ascorbic/macrodata

All issues in ascorbic/macrodata

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.