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

Error loading sharp #4338

Open
4 of 11 tasks
andrsgrza opened this issue Feb 25, 2025 · 2 comments
Open
4 of 11 tasks

Error loading sharp #4338

andrsgrza opened this issue Feb 25, 2025 · 2 comments

Comments

@andrsgrza
Copy link

Possible install-time or require-time problem

You must confirm both of these before continuing.

Are you using the latest version of sharp?

  • I am using the latest version of sharp as reported by npm view sharp dist-tags.latest.

If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.

If you are using another package which depends on a version of sharp that is not the latest,
please open an issue against that package instead.

Are you using a supported runtime?

  • I am using Node.js with a version that satisfies ^18.17.0 || ^20.3.0 || >=21.0.0
  • I am using Deno
  • I am using Bun

If you cannot confirm any of these,
please upgrade to the latest version
and try again before opening an issue.

Are you using a supported package manager and installing optional dependencies?

  • I am using npm >= 10.1.0 with --include=optional
  • I am using yarn >= 3.2.0
  • I am using pnpm >= 7.1.0 with --no-optional=false
  • I am using Deno
  • I am using Bun

If you cannot confirm any of these, please upgrade to the latest version of your chosen package manager
and ensure you are allowing the installation of optional or multi-platform dependencies before opening an issue.

What is the complete error message, including the full stack trace?

This happens upon execution. My code that deployed and executed in an underlying executor service in a docker container that uses almalinux. For which I build a deployment package (zip containing package.json, dist directory and node_modules)
For installation I have used all of these:

But upon execution I am getting:

Initialization has failed due to: Error: Could not load the \"sharp\" module using the linux-x64 runtime\nERR_DLOPEN_FAILED: /tmp/DnwYhjmD/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node: failed to map segment from shared object\nPossible solutions:\n- Ensure optional dependencies can be installed:\n npm install --include=optional sharp\n- Ensure your package manager supports multi-platform installation:\n See https://sharp.pixelplumbing.com/install#cross-platform\n- Add platform-specific dependencies:\n npm install --os=linux --cpu=x64 sharp\n- Consult the installation documentation:\n See https://sharp.pixelplumbing.com/install\n at Object.<anonymous> (/tmp/DnwYhjmD/node_modules/sharp/lib/sharp.js:113:9)\n at Module._compile (node:internal/modules/cjs/loader:1364:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)\n at Module.load (node:internal/modules/cjs/loader:1203:32)\n at Module._load (node:internal/modules/cjs/loader:1019:12)\n at Module.require (node:internal/modules/cjs/loader:1231:19)\n at require (node:internal/modules/helpers:177:18)\n at Object.<anonymous> (/tmp/DnwYhjmD/node_modules/sharp/lib/constructor.js:10:1)\n at Module._compile (node:internal/modules/cjs/loader:1364:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)\n at Module.load (node:internal/modules/cjs/loader:1203:32)\n at Module._load (node:internal/modules/cjs/loader:1019:12)\n at Module.require (node:internal/modules/cjs/loader:1231:19)\n at require (node:internal/modules/helpers:177:18)\n at Object.<anonymous> (/tmp/DnwYhjmD/node_modules/sharp/lib/index.js:6:15)\n at Module._compile (node:internal/modules/cjs/loader:1364:14)"},"processThreadName":"firestorm-triggers-pekko.actor.default-dispatcher-61

What is the complete output of running npm install --verbose --foreground-scripts sharp in an empty directory?

This is not executing on my computer so I wouldn't be able to tell

This is not executing on my computer so I wouldn't be able to tell

What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?

@andrsgrza
Copy link
Author

andrsgrza commented Feb 25, 2025

I have installed with the following variations, all of them leading to the same issue:

npm install --include=optional --no-bin-links --cpu=x64 --os=linux --libc=glibc --only=production
npm install --include=optional --cpu=x64 --os=linux --libc=glibc --only=production

And created my deployment package with and without the --symlinks flag

@lovell
Copy link
Owner

lovell commented Feb 25, 2025

/tmp/DnwYhjmD/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node: failed to map segment from shared object

This looks like #704 and suggests a filesystem permission problem (perhaps lack of exec permission on /tmp).

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

2 participants