fix: remove sharp dependency that was never needed (#1141)

Sharp was an explicit dependency but nothing in the codebase imports it.
Chroma embeddings use ONNX Runtime via @chroma-core/default-embed, not sharp.
Sharp's native binary has a persistent Bun node_modules layout bug where
@img/sharp-libvips-* isn't placed alongside @img/sharp-darwin-* causing
ERR_DLOPEN_FAILED on every install.

- Remove sharp, @img/sharp-libvips-darwin-arm64, node-gyp from deps
- Remove node-addon-api from devDeps
- Remove @img cache clearing hacks from smart-install.js and sync-marketplace.cjs
- Replace with simple `bun pm cache rm` before install as general cache hygiene

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2026-02-16 19:20:34 -05:00
committed by GitHub
parent 8039ada222
commit f1162ed4a4
3 changed files with 15 additions and 27 deletions
+9 -10
View File
@@ -5,7 +5,7 @@
* Ensures Bun runtime and uv (Python package manager) are installed
* (auto-installs if missing) and handles dependency installation when needed.
*/
import { existsSync, readFileSync, writeFileSync, rmSync } from 'fs';
import { existsSync, readFileSync, writeFileSync } from 'fs';
import { execSync, spawnSync } from 'child_process';
import { join } from 'path';
import { homedir } from 'os';
@@ -260,18 +260,17 @@ function installDeps() {
console.error('📦 Installing dependencies with Bun...');
// Clear stale native module cache (sharp/libvips) to prevent broken dylib references.
// Bun's cache can retain native binaries that reference companion libraries at
// broken relative paths after version upgrades.
const bunCacheImgDir = join(homedir(), '.bun', 'install', 'cache', '@img');
if (existsSync(bunCacheImgDir)) {
console.error(' Clearing stale native module cache (@img/sharp)...');
rmSync(bunCacheImgDir, { recursive: true, force: true });
}
// Quote path for Windows paths with spaces
const bunCmd = IS_WINDOWS && bunPath.includes(' ') ? `"${bunPath}"` : bunPath;
// Clear Bun's package cache to prevent stale native module artifacts
try {
execSync(`${bunCmd} pm cache rm`, { cwd: ROOT, stdio: 'pipe', shell: IS_WINDOWS });
console.error(' Cleared Bun package cache');
} catch {
// Cache may not exist yet on first install
}
execSync(`${bunCmd} install`, { cwd: ROOT, stdio: 'inherit', shell: IS_WINDOWS });
// Write version marker