Issues after sharp update to 0.30.7
Closed this issue · 4 comments
I saw that sharp was updated from 0.29.3 to 0.30.7 and after that update, I got some issues.
On my windows machine:
Error:
Something went wrong installing the "sharp" module
The specified procedure could not be found.
\\?\C:\Users\*\Documents\*\backend\node_modules\payload-blurhash-plugin\node_modules\sharp\build\Release\sharp-win32-x64.node
On my ubuntu server when I upload a file:
node: symbol lookup error: /root/*/backend/node_modules/payload-blurhash-plugin/node_modules/sharp/build/Release/sharp-linux-x64.node: undefined symbol: vips_fail_on_get_type
My proposal:
We use the sharp lib only here:
https://github.com/invakid404/payload-blurhash-plugin/blob/master/src/index.ts#L71
Maybe we can dump the whole lib and replace it with a canvas
Its also way lighter to run and bundle:
https://bundlephobia.com/package/sharp@0.30.7
https://bundlephobia.com/package/canvas@2.9.3 (we need to polyfill it for node)
Any thoughts? I can create a pr if its a solution
Hmm, I don't remember observing errors after the sharp update. Still though, if we could use a canvas to retrieve the raw pixels from the image, it'd be fine by me.
The problem is that you can't have multiple versions of sharp in the deps
lovell/sharp#1680
Payload core uses sharp 0.29.3 and this plugin is now 0.30.7
Also, the proposed package canvas cant be used in combination with sharp in the project from what I can tell.
Automattic/node-canvas#1386
Need to think about how we can fix this. For now, I downgraded the plugin to version 1.0.1 where the sharp version is 0.29.3 and cleaned my yarn cache
@matthijs166 things seem to work properly if I move sharp to "peerDependencies". Can you try payload-blurhash-plugin@alpha
and let me know if it fixes things for you?
I've done some testing and I've concluded this fix should be okay for now. I've unpublished 1.0.2 and have published a new 1.0.3, which should work okay. Please reopen this if the issue still persists.