-
Notifications
You must be signed in to change notification settings - Fork 440
Description
🐛 Issue: Update sharp dependency to support Windows ARM64
Summary
When using the @imgly/background-removal-node package on Windows ARM64 devices, the module fails to load due to an outdated sharp dependency that does not include ARM64 prebuilt binaries.
Updating sharp to v0.34.2 or higher should resolve this issue, as recent versions now provide official Windows ARM64 support.
Environment
- OS: Windows 11 ARM64
- Node.js: v22.11.0 (arm64)
- Package:
@imgly/background-removal-node - Dependency causing issue:
sharp(currently "~0.32.4" wich resolves to 0.32.6)
Error Output
Error: Could not load the "sharp" module using the win32-arm64 runtime
Possible solutions:
- Manually install libvips >= 8.15.3
- Add experimental WebAssembly-based dependencies:
npm install --cpu=wasm32 sharp
npm install @img/sharp-wasm32
- Consult the installation documentation:
See https://sharp.pixelplumbing.com/install
at Object.<anonymous> (******\node_modules\ndarray-pixels\node_modules\sharp\lib\sharp.js:113:9)
at Module._compile (node:internal/modules/cjs/loader:1546:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1689:10)
at Module.load (node:internal/modules/cjs/loader:1318:32)
at Module._load (node:internal/modules/cjs/loader:1128:12)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
at Module.require (node:internal/modules/cjs/loader:1340:12)
at require (node:internal/modules/helpers:141:16)
at Object.<anonymous> (******\node_modules\ndarray-pixels\node_modules\sharp\lib\constructor.js:10:1)Steps to Reproduce
-
Install Node.js v22.11.0 (ARM64) on Windows ARM device.
-
Install
@imgly/background-removal-nodeusing npm or yarn. -
Try to import it in a Node.js script:
const { removeBackground } = require('@imgly/background-removal-node');
-
Observe the runtime error above.
Expected Behavior
The library should load and function correctly on Windows ARM64 systems without manual compilation or use of the WebAssembly fallback.
Suggested Fix
-
Bump
sharpto version ≥0.34.2in the project’s dependencies.
Example:"dependencies": { "sharp": "^0.34.2" }
-
This version introduces prebuilt binaries for Windows ARM64, eliminating the need for manual libvips installation or WASM fallbacks.