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
-1
View File
@@ -118,7 +118,6 @@
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"esbuild": "^0.27.2",
"node-addon-api": "^8.5.0",
"np": "^11.0.2",
"tsx": "^4.20.6",
"typescript": "^5.3.0"
+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
+6 -16
View File
@@ -80,22 +80,12 @@ try {
{ stdio: 'inherit' }
);
// Remove stale lockfiles before install — they pin old native dep versions
const { unlinkSync, rmSync } = require('fs');
for (const lockfile of ['package-lock.json', 'bun.lock']) {
const lockpath = path.join(INSTALLED_PATH, lockfile);
if (existsSync(lockpath)) {
unlinkSync(lockpath);
console.log(`Removed stale ${lockfile}`);
}
}
// Clear stale native module cache (sharp/libvips) — Bun's cache can retain
// native binaries that reference companion libraries at broken relative paths
const bunCacheImgDir = path.join(os.homedir(), '.bun', 'install', 'cache', '@img');
if (existsSync(bunCacheImgDir)) {
rmSync(bunCacheImgDir, { recursive: true, force: true });
console.log('Cleared stale native module cache (@img/sharp)');
// Clear Bun's package cache to prevent stale native module artifacts
try {
execSync('bun pm cache rm', { cwd: INSTALLED_PATH, stdio: 'pipe' });
console.log('Cleared Bun package cache');
} catch {
// Cache may not exist yet on first install
}
console.log('Running bun install in marketplace...');