sharp fails to load: missing trustedDependencies in package.json

オープン 初心者向け
#24 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
74/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
bun
領域
tooling

調査の方向性

plugins/macrodata/package.json を開いて依存関係の設定を確認し、その後 Bun の trustedDependencies の動作を読みます。プラグインで bun install を実行し、報告された環境で search_memory ツールが正常に読み込まれるよう、sharp のネイティブバイナリが利用可能であることを確認します。

索引モデルが issue の本文から書いたものです。

説明

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)
主要言語
TypeScript
スター
119
フォーク
6
平均マージ
1時間 32分
マージ済み PR(30日)
2

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ascorbic/macrodata のほかの issue

ascorbic/macrodata の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。