Summary
Fresh npm i -g openclaw does not install sharp, causing browser screenshot image resize and media-understanding image ops to fail with:
Optional dependency sharp is required for image attachment processing
Root Cause
extensions/media-understanding-core/image-ops.ts:57 dynamically imports sharp and throws when it's missing. However, sharp is not declared in package.json under dependencies, optionalDependencies, or peerDependencies. So npm install never installs it.
Users currently have to manually run:
SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm i [email protected] --no-save --prefix $(dirname $(realpath $(which openclaw)))/..
Suggested Fix
Add sharp to optionalDependencies in root package.json:
"optionalDependencies": {
+ "sharp": "^0.34.5",
"sqlite-vec": "0.1.9"
}
Using optionalDependencies (not dependencies) because:
- sharp has native bindings that can fail to build on some platforms (Homebrew libvips conflicts, musl, etc.)
- The codebase already handles the missing-sharp case gracefully with a clear error message
- This matches the existing pattern used for
sqlite-vec
Environment
- OpenClaw 2026.5.16-beta.6
- macOS, Node 22
- Affects: browser screenshot resize, media-understanding image ops, any path through
extensions/media-understanding-core/image-ops.ts
Summary
Fresh
npm i -g openclawdoes not installsharp, causing browser screenshot image resize and media-understanding image ops to fail with:Root Cause
extensions/media-understanding-core/image-ops.ts:57dynamically importssharpand throws when it's missing. However,sharpis not declared inpackage.jsonunderdependencies,optionalDependencies, orpeerDependencies. Sonpm installnever installs it.Users currently have to manually run:
Suggested Fix
Add
sharptooptionalDependenciesin rootpackage.json:"optionalDependencies": { + "sharp": "^0.34.5", "sqlite-vec": "0.1.9" }Using
optionalDependencies(notdependencies) because:sqlite-vecEnvironment
extensions/media-understanding-core/image-ops.ts