#4610·sharp

ERR_DLOPEN_FAILED: Error loading shared library libstdc++.so.6

Author: peppergrayxyzCreated Sep 21, 2026Updated Sep 22, 2026
Labelsenhancementready-to-shipinstallation

Possible install-time or require-time problem

Installing sharp on gentoo/stage3:musl-llvm(using libc++) fails with errors:

Error: Could not load the "sharp" module using the linuxmusl-arm64 runtime
ERR_DLOPEN_FAILED: Error loading shared library libstdc++.so.6: 

Eventually this manual build enabled compatibility with libc++ . On a system where a binary is availble now, it is downloaded, but the binary is linked against libstdc++.

Before 0.35.0 a build from source was triggered during install, when a globally-installed libvips was detected. That was removed and a build from source must be triggered manually (changelog).

It would be great if there was a more gracefull behavior than failing with an exception, ideally the install would trigger a source build when a system without stdlibc++ is detected.

--

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.

Are you using a supported runtime?

  • I am using Node.js with a version that satisfies >=20.9.0
  • I am using Deno
  • I am using Bun

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

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

$ npm install sharp --include=optional

up to date, audited 7 packages in 775ms

3 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
$ node -e "const sharp = require('sharp')"
node-test/node_modules/sharp/dist/sharp.cjs:171
  throw new Error(help.join("\n"));
  ^

Error: Could not load the "sharp" module using the linuxmusl-arm64 runtime
ERR_DLOPEN_FAILED: Error loading shared library libstdc++.so.6: 
No such file or directory (needed by node-test/node_modules/@img/sharp-linuxmusl-arm64/lib/sharp-linuxmusl-arm64-0.35.4.node)
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 --libc=musl --cpu=arm64 sharp
- Consult the installation documentation:
    See https://sharp.pixelplumbing.com/install
    at Object.<anonymous> (node-test/node_modules/sharp/dist/sharp.cjs:171:9)
    at Module._compile (node:internal/modules/cjs/loader:1934:14)
    at Object..js (node:internal/modules/cjs/loader:2074:10)
    at Module.load (node:internal/modules/cjs/loader:1656:32)
    at Module._load (node:internal/modules/cjs/loader:1448:12)
    at wrapModuleLoad (node:internal/modules/cjs/loader:261:19)
    at Module.require (node:internal/modules/cjs/loader:1679:12)
    at require (node:internal/modules/helpers:196:16)
    at Object.<anonymous> (node-test/node_modules/sharp/dist/constructor.cjs:10:1)
    at Module._compile (node:internal/modules/cjs/loader:1934:14)

Node.js v26.8.2

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

npm verbose cli /usr/bin/node /home/pepper/.npm-packages/bin/npm npm info using [email protected] npm info using [email protected] npm verbose title npm install sharp npm verbose argv "install" "--loglevel" "verbose" "--foreground-scripts" "sharp" npm verbose logfile logs-max:10 dir:/home/pepper/.npm/_logs/2026-09-21T15_30_34_612Z- npm verbose logfile /home/pepper/.npm/_logs/2026-09-21T15_30_34_612Z-debug-0.log npm http cache https://registry.npmjs.org/sharp 21ms (cache hit) npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 375ms

up to date, audited 7 packages in 779ms

3 packages are looking for funding run npm fund for details

found 0 vulnerabilities npm verbose cwd /home/pepper/dev/misc/node-test/a npm verbose os Linux 7.2.6-gentoo-dist-hardened npm verbose node v26.8.2 npm verbose npm v12.0.2 npm verbose exit 0 npm info ok

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

System: OS: Linux 7.2 undefined CPU: (80) arm64 Neoverse-N1 Memory: 487.81 GB / 502.25 GB Container: Yes Shell: 5.9 - /bin/zsh Binaries: Node: 26.8.2 - /usr/bin/node Yarn: 4.18.0 - /home/pepper/.npm-packages/bin/yarn npm: 12.0.2 - /home/pepper/.npm-packages/bin/npm pnpm: 12.5.1 - /home/pepper/.npm-packages/bin/pnpm