nuxt / nuxt/image

IPX provider only works with override of `sharp` dependency on linux-arm64

Open
#2,019 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.5k
Forks
331
Avg merge
19h 52m
Merged PRs (30d)
9

Description

Hello,

first of all I am not sure if this is a bug in nuxt-image, ipx, sharp, bun or another package so please let me know if this is the wrong repo for the report.

I just updated to nuxt-image v2.0.0 and only can get it to work with IPX as a provider if I use the "overrides" field in package.json to pin a specific version of the sharp dependency. If I don't use the override field and let the dependencies be resolved automatically I get the following response if I load an image in my nuxt app:

[500] [IPX_ERROR] Could not load the \"sharp\" module using the linux-arm64 runtime
ERR_DLOPEN_FAILED: libstdc++.so.6: cannot open shared object file: No such file or directory

After some debugging I think the main problem is the used version of the detect-libc sub dependency. Here is the diff between the two lockfiles (a/bun.lock = no override, broken; b/bun.lock = override, works):

diff --git a/bun.lock b/bun.lock
index a90531fd..bf0f82cf 100644
--- a/bun.lock
+++ b/bun.lock
@@ -52,6 +52,7 @@
   },
   "overrides": {
     "archiver": "^7.0.1",
+    "sharp": "0.34.5",
     "unzipper": "^0.12.3",
     "vite": "npm:rolldown-vite@7.2.0",
   },
@@ -1312,7 +1313,7 @@
 
-    "detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="],
+    "detect-libc": ["detect-libc@1.0.3", "", { "bin": { "detect-libc": "./bin/detect-libc.js" } }, "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg=="],
 
@@ -2490,6 +2491,8 @@
 
+    "@mapbox/node-pre-gyp/detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="],
     
@@ -2520,8 +2523,6 @@
 
-    "@parcel/watcher/detect-libc": ["detect-libc@1.0.3", "", { "bin": { "detect-libc": "./bin/detect-libc.js" } }, "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg=="],

@@ -2642,6 +2643,8 @@
 
+    "lightningcss/detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="],

@@ -2690,6 +2693,8 @@
 
+    "sharp/detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="],

The sharp/detect-libc is only installed if I use the sharp version override which maybe causes the issue?

Additional Info
  • I don't know for sure if the bug was introduced in v2.0.0 of nuxt-image, since I was using a sharp override before as well due to #1908
  • The issue only occurs on the deployment server that uses linux-arm64. Locally on darwin in works fine
output of ldding the sharp-binary
sharp v0.34.5 (no override) ❌
# ldd .output/server/node_modules/@img/sharp-linux-arm64/lib/sharp-linux-arm64.node
        linux-vdso.so.1 (0x0000e199b2a25000)
        libvips-cpp.so.8.17.3 => /app/.output/server/node_modules/@img/sharp-linux-arm64/lib/../../sharp-libvips-linux-arm64/lib/libvips-cpp.so.8.17.3 (0x0000e199b1710000)
        libstdc++.so.6 => /lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000e199b1480000)
        libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000e199b13d0000)
        libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000e199b1390000)
        libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000e199b1360000)
        libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000e199b11a0000)
        /lib/ld-linux-aarch64.so.1 (0x0000e199b29e8000)
        libresolv.so.2 => /lib/aarch64-linux-gnu/libresolv.so.2 (0x0000e199b1170000)
        libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000e199b1140000)

sharp v0.34.5 (via override) ✅
# ldd .output/server/node_modules/@img/sharp-linux-arm64/lib/sharp-linux-arm64.node
        linux-vdso.so.1 (0x0000f2e10cd6b000)
        libvips-cpp.so.8.17.3 => /app/.output/server/node_modules/@img/sharp-linux-arm64/lib/../../sharp-libvips-linux-arm64/lib/libvips-cpp.so.8.17.3 (0x0000f2e10ba50000)
        libstdc++.so.6 => /nix/store/zmjqwzhgl9hwr8xnk8raj8d50lzkql66-gcc-14.3.0-lib/lib/libstdc++.so.6 (0x0000f2e10b7e0000)
        libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000f2e10b730000)
        libgcc_s.so.1 => /nix/store/zmjqwzhgl9hwr8xnk8raj8d50lzkql66-gcc-14.3.0-lib/lib/libgcc_s.so.1 (0x0000f2e10b6f0000)
        libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000f2e10b6c0000)
        libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000f2e10b500000)
        /lib/ld-linux-aarch64.so.1 (0x0000f2e10cd2e000)
        libresolv.so.2 => /lib/aarch64-linux-gnu/libresolv.so.2 (0x0000f2e10b4d0000)
        libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000f2e10b4a0000)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the working and failing bun.lock files, then reproduce the IPX image request on the linux-arm64 deployment. Inspect the sharp runtime and its detect-libc resolution, along with the package.json override and the reported ldd output. Done means the IPX provider loads images on linux-arm64 without requiring a sharp override or missing libstdc++.so.6.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, linux, nuxtjs
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.