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

Could not load the "sharp" module using the linux-x64 runtime #4278

Closed Ararat-Bakaryan closed 3 days ago

Ararat-Bakaryan commented 5 days ago

Error Loading Sharp Module on Linux x64

Description

When running the application, encountering a fatal error preventing the Sharp module from loading on Linux x64 platform. The error occurs in the main process and appears to be related to dynamic module loading configuration in Rollup.

Error Message

Error: Could not load the "sharp" module using the linux-x64 runtime

Multiple failed require attempts:

Environment

Additional warning observed:

MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

Attempted Solutions

None yet, but Sharp's documentation suggests:

  1. Installing optional dependencies:
    npm install --include=optional sharp
  2. Using platform-specific installation:
    npm install --os=linux --cpu=x64 sharp
Ararat-Bakaryan commented 5 days ago

After building the app using electron-forge and vite-plugin, I am getting this issue when launching the app, please help resolve the problem!

jigyar2001 commented 5 days ago

I have the same problem, too. How can I solve the problem?

lovell commented 4 days ago

building the app using electron-forge and vite-plugin

https://github.com/lovell/sharp/blob/hat/docs/install.md#electron https://github.com/lovell/sharp/blob/hat/docs/install.md#vite

jigyar2001 commented 4 days ago

building the app using electron-forge and vite-plugin

https://github.com/lovell/sharp/blob/hat/docs/install.md#electron https://github.com/lovell/sharp/blob/hat/docs/install.md#vite

I followed the instructions and now I get this: Error: Could not load the "sharp" module using the linux-x64 runtime

jigyar2001 commented 4 days ago

Full log

Error: Could not load the "sharp" module using the linux-x64 runtime Possible solutions:

jigyar2001 commented 4 days ago

Using official electron-forge documentation for configuration: https://www.electronforge.io/config/plugins/vite

Ararat-Bakaryan commented 4 days ago

Hi @lovell thanks for the quick reply! Unfortunately the problem remains do you have any suggestions?

lovell commented 4 days ago

If you're using electron-forge, watch out for https://github.com/electron/forge/issues/1250

If you're still having problems, please provide a minimal, complete, standalone repo that allows someone else to reproduce.

Ararat-Bakaryan commented 3 days ago

@lovell Thank you very much for your answer, I have already changed the build to electron-builder and everything is working.