JonasKruckenberg / imagetools

Load and transform images using a toolbox :toolbox: of custom import directives!
MIT License
909 stars 56 forks source link

v6 broken due to missing sharp 0.33 binariers #693

Closed chojnicki closed 7 months ago

chojnicki commented 7 months ago

I've upgraded Vite 4 to 5 and all plugins, and only imagetools broke.

frontend-1  | failed to load config from /usr/src/front/vite.config.js
frontend-1  | error when starting dev server:
frontend-1  | Error: Could not load the "sharp" module using the linux-x64 runtime
frontend-1  | Possible solutions:
frontend-1  | - Ensure optional dependencies can be installed:
frontend-1  |     npm install --include=optional sharp
frontend-1  |     yarn add sharp --ignore-engines
frontend-1  | - Ensure your package manager supports multi-platform installation:
frontend-1  |     See https://sharp.pixelplumbing.com/install#cross-platform
frontend-1  | - Add platform-specific dependencies:
frontend-1  |     npm install --os=linux --cpu=x64 sharp
frontend-1  | - Consult the installation documentation:
frontend-1  |     See https://sharp.pixelplumbing.com/install
frontend-1  |     at Object.<anonymous> (/usr/src/front/node_modules/sharp/lib/sharp.js:114:9)
frontend-1  |     at Module._compile (node:internal/modules/cjs/loader:1376:14)
frontend-1  |     at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
frontend-1  |     at Module.load (node:internal/modules/cjs/loader:1207:32)
frontend-1  |     at Module._load (node:internal/modules/cjs/loader:1023:12)
frontend-1  |     at Module.require (node:internal/modules/cjs/loader:1235:19)
frontend-1  |     at require (node:internal/modules/helpers:176:18)
frontend-1  |     at Object.<anonymous> (/usr/src/front/node_modules/sharp/lib/constructor.js:10:1)
frontend-1  |     at Module._compile (node:internal/modules/cjs/loader:1376:14)
frontend-1  |     at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Of course I'm not going to install sharp manually like advised in console - it's dependency of imagetools so it should work out of the box like before.

I found same issues sharp v0.33, but they are marked as solved because this supposed to be bug with Vercel which was fixed, but Vercel is not used here :P

https://github.com/lovell/sharp/issues/3870 https://github.com/lovell/sharp/issues/3900

What I tried:

It's indeed something with sharp, because when there is 0.33 in lock file it crashesh, but downgrading sharp by downgrading imagetools helps


EDIT: version 6.1.0 also works. In changelog it states that sharp 0.33 was included in 6.2.7 so 6.2.6 should work fine but no, locking it to 6.2.6 still installs latest sharp.

benmccann commented 7 months ago

Please report in the sharp repository

chojnicki commented 7 months ago

@benmccann but I'm using imagetools, not sharp. So this is correct repository for issue. Especially that author of sharp is saying that this not bug in sharp, but implementation. Even if it is bug in sharp, again, I'm not installing it. It is dependency of this library, so if You think that this version is defective, it should be downgraded here :)

benmccann commented 7 months ago

No. That logic doesn't fly with any open source project. Maintainers can't possibly be responsible for bugs in all the libraries that they use. And those libraries also have their own dependencies. Many projects would be responsible for bugs in thousands of libraries at that rate. If you can show we've done something wrong in this project then we can address it. If you're using yarn this may be a duplicate of https://github.com/JonasKruckenberg/imagetools/issues/659. Otherwise there's nothing to suggest there's a bug in this library