Skip to content

Update sharp dependency to support Windows ARM64 #162

@josepxhj

Description

@josepxhj

🐛 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

  1. Install Node.js v22.11.0 (ARM64) on Windows ARM device.

  2. Install @imgly/background-removal-node using npm or yarn.

  3. Try to import it in a Node.js script:

    const { removeBackground } = require('@imgly/background-removal-node');
  4. 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 sharp to version ≥ 0.34.2 in 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.


References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions