Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Ararat-Bakaryan opened this issue Nov 21, 2024 · 9 comments
Closed

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

Ararat-Bakaryan opened this issue Nov 21, 2024 · 9 comments

Comments

@Ararat-Bakaryan
Copy link

Ararat-Bakaryan commented Nov 21, 2024

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:

  • ../src/build/Release/sharp-linux-x64.node
  • ../src/build/Release/sharp-wasm32.node
  • @img/sharp-linux-x64/sharp.node
  • @img/sharp-wasm32/sharp.node

Environment

  • Platform: Linux x64
  • Application: electron-unique
  • Location: /usr/lib/electron-uniq/resources/app.asar/.vite/build/main.js

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
Copy link
Author

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

This comment was marked as off-topic.

@Ararat-Bakaryan Ararat-Bakaryan changed the title Could not load the "sharp" module using the linux-x64 runtime undefined: Could not dynamically require "../src/build/Release/sharp-linux-x64.node". Could not load the "sharp" module using the linux-x64 runtime undefined Nov 21, 2024
@Ararat-Bakaryan Ararat-Bakaryan changed the title Could not load the "sharp" module using the linux-x64 runtime undefined Could not load the "sharp" module using the linux-x64 runtime Nov 21, 2024
@lovell
Copy link
Owner

lovell commented Nov 21, 2024

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
Copy link

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
Copy link

Full log

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

  • Ensure optional dependencies can be installed:
    npm install --include=optional sharp
  • Ensure your package manager supports multi-platform installation:
    See https://sharp.pixelplumbing.com/install#cross-platform
  • Add platform-specific dependencies:
    npm install --os=linux --cpu=x64 sharp
  • Consult the installation documentation:
    See https://sharp.pixelplumbing.com/install
    at Object. (/usr/lib/electron-uniq/resources/app.asar/node_modules/sharp/lib/sharp.js:113:9)
    at Module._compile (node:internal/modules/cjs/loader:1373:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1432:10)
    at Module.load (node:internal/modules/cjs/loader:1215:32)
    at Module._load (node:internal/modules/cjs/loader:1031:12)
    at c._load (node:electron/js2c/node_init:2:17025)
    at Module.require (node:internal/modules/cjs/loader:1240:19)
    at require (node:internal/modules/helpers:179:18)
    at Object. (/usr/lib/electron-uniq/resources/app.asar/node_modules/sharp/lib/constructor.js:10:1)
    at Module._compile (node:internal/modules/cjs/loader:1373:14)

@jigyar2001
Copy link

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

@Ararat-Bakaryan
Copy link
Author

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

@lovell
Copy link
Owner

lovell commented Nov 22, 2024

If you're using electron-forge, watch out for electron/forge#1250

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

@Ararat-Bakaryan
Copy link
Author

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

@lovell lovell closed this as completed Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants