emil-petras / strapi-blurhash

A plugin for Strapi CMS that generates blurhash for your uploaded images
https://www.npmjs.com/package/strapi-blurhash
20 stars 16 forks source link

Could not load the "sharp" module #20

Closed maximehamou closed 6 days ago

maximehamou commented 6 months ago

Hello, I have this error in local (MacOS) and in production (Debian) :

[2024-05-23 18:13:47.266] debug: ⛔️ Server wasn't able to start properly.
[2024-05-23 18:13:47.267] error: Could not load js config file /app/node_modules/strapi-blurhash/strapi-server.js: Could not load the "sharp" module using the linux-x64 runtime

I think there is an issue in the way that the plugin uses sharp.

Thank you for your help.

emil-petras commented 6 months ago

On mac, try

brew install pkg-config brew install libvips

On debian: sudo apt-get update sudo apt-get install -y build-essential sudo apt-get install -y libvips-dev

maximehamou commented 6 months ago

But is it normal that it always happen using the plugin if I not do that?

emil-petras commented 6 months ago

I will try to find a way for this to be solved automatically during installation.

maximehamou commented 6 months ago

Ok thank you ! Because there is a really big quantity of packages in libvips-dev !

EDIT : installing these packages does not solve the problem.

maximehamou commented 6 months ago

EDIT : installing these packages does not solve the problem.

So, do you have any other ideas? Thanks!

emil-petras commented 5 months ago

I've removed the sharp dependency in the new version.

maximehamou commented 2 months ago

There is now this error :

Error: Could not load js config file
/Users/Maxime/Desktop/Projets_de_code/zakine-avocats.fr/backend/node_modules/strapi-blurhash/strapi-server.js: Cannot find module 'canvas' 
emil-petras commented 6 days ago

@maximehamou sudo apt-get update sudo apt-get install -y build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev npm install canvas npm list canvas