lovell / sharp

High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
https://sharp.pixelplumbing.com
Apache License 2.0
29.33k stars 1.3k forks source link

Improve error message to use sharp in electron ( for yarn ) #4216

Closed Makio64 closed 2 months ago

Makio64 commented 2 months ago

Feature request

What are you trying to achieve?

When using sharp in electron I got an error. In previous version the error message indicate the commands to fix the issue on npm and yarn, now only for npm

What would you expect the API to look like?

Write the solution for yarn : yarn add sharp --ignore-engines Ideally for pnpm as well.

What alternatives have you considered?

Would be great if it works out of the box on electron but it seems difficult.

Please provide sample image(s) that help explain this feature

When using sharp in Electron : Uncaught Exception: Error: Could not load the "sharp" module using the darwin-arm64 runtime

Screenshot 2024-09-12 at 15 28 43

after yarn add sharp --ignore-engines it works.

lovell commented 2 months ago

Please ensure you are using the latest version, currently v0.33.5.

https://github.com/lovell/sharp/issues/4130

Makio64 commented 2 months ago

I'm using the v0.33.5

lovell commented 2 months ago

This looks more like an Electron packaging issue rather than a yarn installation issue, based partly on the .app/Contents/... path in the screenshot.

The use of yarn v1 at install time is tested via a post-release CI job:

https://github.com/lovell/sharp/blob/b249357732698853b00dbc7c93a284db7aeb6f1b/.github/workflows/npm.yml#L178-L184

https://github.com/lovell/sharp/actions/runs/10419935381/job/28860731321

If you still require help, please provide a minimal sample repo that allows someone else to reproduce.