Repository navigation
Description
Possible install-time or require-time problem
I'm running into the same issue as #3870, but I'm running locally in WSL.
- I have read the documentation relating to installation.
Are you using the latest version of sharp?
- I am using the latest version of
sharpas reported bynpm 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 >= 9.6.5 with
--include=optional - I am using yarn >= 3.2.0 and I am not using the "Plug'n'Play" linker
- 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 dependencies before opening an issue.
What is the complete output of running npm install --verbose --foreground-scripts sharp in an empty directory?
Details
$ npm install --verbose --foreground-scripts sharp
npm verb cli /snap/node/7823/bin/node /snap/node/7823/bin/npm
npm info using [email protected]
npm info using [email protected]
npm verb title npm install sharp
npm verb argv "install" "--loglevel" "verbose" "--foreground-scripts" "sharp"
npm verb logfile logs-max:10 dir:/home/eric/.npm/_logs/2023-12-07T20_41_33_116Z-
npm verb logfile /home/eric/.npm/_logs/2023-12-07T20_41_33_116Z-debug-0.log
npm http fetch GET 200 https://registry.npmjs.org/sharp 92ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/detect-libc 33ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/semver 58ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/color 80ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-arm64 199ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-wasm32 375ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linuxmusl-arm64 883ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linuxmusl-x64 893ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-darwin-arm64 900ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-arm 911ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-darwin-x64 930ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-s390x 928ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-win32-x64 950ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-x64 952ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-darwin-arm64 959ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-darwin-x64 959ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-s390x 960ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-x64 971ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linuxmusl-arm64 973ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-arm64 977ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-arm 1282ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linuxmusl-x64 1751ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-win32-ia32 1803ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/color-string 27ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/color-convert 36ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/lru-cache 45ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@emnapi%2fruntime 919ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/tslib 40ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/color-name 29ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/color-name 34ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/simple-swizzle 39ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/is-arrayish 53ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/yallist 32ms (cache miss)
npm verb reify failed optional dependency /home/eric/code/foo/node_modules/@img/sharp-win32-x64
npm verb reify failed optional dependency /home/eric/code/foo/node_modules/@img/sharp-win32-ia32
npm verb reify failed optional dependency /home/eric/code/foo/node_modules/@img/sharp-wasm32
npm verb reify failed optional dependency /home/eric/code/foo/node_modules/@emnapi/runtime
npm verb reify failed optional dependency /home/eric/code/foo/node_modules/tslib
npm verb reify failed optional dependency /home/eric/code/foo/node_modules/@img/sharp-linuxmusl-arm64
npm verb reify failed optional dependency /home/eric/code/foo/node_modules/@img/sharp-linux-s390x
npm verb reify failed optional dependency /home/eric/code/foo/node_modules/@img/sharp-linux-arm64
npm verb reify failed optional dependency /home/eric/code/foo/node_modules/@img/sharp-linux-arm
npm verb reify failed optional dependency /home/eric/code/foo/node_modules/@img/sharp-libvips-linuxmusl-arm64
npm verb reify failed optional dependency /home/eric/code/foo/node_modules/@img/sharp-libvips-linux-s390x
npm verb reify failed optional dependency /home/eric/code/foo/node_modules/@img/sharp-libvips-linux-arm64
npm verb reify failed optional dependency /home/eric/code/foo/node_modules/@img/sharp-libvips-linux-arm
npm verb reify failed optional dependency /home/eric/code/foo/node_modules/@img/sharp-libvips-darwin-x64
npm verb reify failed optional dependency /home/eric/code/foo/node_modules/@img/sharp-libvips-darwin-arm64
npm verb reify failed optional dependency /home/eric/code/foo/node_modules/@img/sharp-darwin-x64
npm verb reify failed optional dependency /home/eric/code/foo/node_modules/@img/sharp-darwin-arm64
npm http fetch GET 200 https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz 34ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz 40ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz 39ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/color/-/color-4.2.3.tgz 43ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz 55ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/sharp/-/sharp-0.33.0.tgz 56ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.0.tgz 331ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.0.tgz 455ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@emnapi/runtime/-/runtime-0.44.0.tgz 456ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.0.tgz 458ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.0.tgz 593ms (cache miss)
npm info run [email protected] install node_modules/sharp node install/check
[email protected] install
node install/check
npm info run [email protected] install { code: 0, signal: null }
added 15 packages in 4s
5 packages are looking for funding
run npm fund for details
npm verb exit 0
npm info ok
What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?
System:
OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
CPU: (32) x64 AMD Ryzen 9 7950X 16-Core Processor
Memory: 21.94 GB / 30.91 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 18.18.0 - /snap/bin/node
Yarn: 1.22.19 - /snap/bin/yarn
npm: 9.8.1 - /snap/bin/npm
pnpm: 8.7.0 - /mnt/c/Users/eric/AppData/Roaming/npm/pnpm
npmPackages:
sharp: ^0.33.0 => 0.33.0
Activity
Downgrades sharp dep as it causes build issues on WSL
lovell commentedon Dec 7, 2023
Hi, please can you provide answers to all of the questions in the issue template.
eamodio commentedon Dec 7, 2023
@lovell Updated
lovell commentedon Dec 7, 2023
Thank you, please can you also provide the complete output of running
node -e "require('sharp')"in the/home/eric/code/foodirectory (it should provide an error message with stack trace and suggestions).eamodio commentedon Dec 7, 2023
lovell commentedon Dec 7, 2023
Thank you, it looks like you're using Node.js installed from the Snap Store. nodejs/snap#54 suggests there are known problems relating to it partially linking to system libraries rather than core libraries, which rather defeats the point of snaps.
The output of
ldd node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.42should provide the list of libraries discovered and used at runtime.[-]WSL: Could not load the "sharp" module using the linux-x64 runtime[/-][+]WSL: Node.js installed from Snap Store, Could not load the "sharp" module using the linux-x64 runtime[/+]lovell commentedon Dec 8, 2023
I've been able to reproduce this locally:
Explicitly setting
LD_LIBRARY_PATHensures the shared libraries fromcore20are used instead of system libraries so the following works correctly:This relates to classic confinement, where every shared library under control of the snap is assumed to have an
RPATHthat points inside the snap-managed filesystem.The prebuilt libvips binaries provided by sharp do not set
RPATH, which is correct, as we want whatever is using them to control where system-level libraries should be found.In summary, using any native module with a snap-installed Node.js allows escape from classic confinement, which means you'll always need to ensure the version of
corematches the version of the OS. For example, when using Ubuntu 22.04 provided by WSL, you should always use a Node.js snap that is dependent oncore22.[-]WSL: Node.js installed from Snap Store, Could not load the "sharp" module using the linux-x64 runtime[/-][+]WSL: Node.js 18 installed from Snap Store, Could not load the "sharp" module using the linux-x64 runtime[/+]lovell commentedon Dec 11, 2023
There are quite a few issues relating to this at https://github.com/nodejs/snap/issues
I've added some help text that will be displayed upon failure via commit 9e3b021
NormandoHall commentedon Dec 12, 2023
The same but not snap node:
Installed and build on Centos 7 with Developer Toolset 7 as usual.
Maybe can fixed similar to this? #2119
lovell commentedon Dec 12, 2023
@NormandoHall As of sharp v0.33.0, the prebuilt binaries no longer support Centos 7.
https://sharp.pixelplumbing.com/install#prebuilt-binaries
lovell/sharp-libvips#176
lovell commentedon Dec 12, 2023
Commit c5eaeb2 will show help text relating to use of an outdated libc when this error message occurs.
AlastairTaft commentedon Dec 29, 2023
lovell commentedon Dec 29, 2023
@AlastairTaft Please can you open a new installation issue and answer all of the questions.
AlastairTaft commentedon Dec 29, 2023
lovell commentedon Dec 29, 2023
@AlastairTaft Pinning a dependency to a previous, unsupported version is unlikely to be the right long-term solution to a problem.
For anyone coming here - please open a new installation issue and answer all of the questions if you still require help.
(I'm hiding your comments as they introduce the L word to an issue that had previously never used it. This helps prevent search engines indexing this issue as relating to the L word. There are many other issues that do relate to the L word and I'd prefer people saw those first. I hope you understand.)
AlastairTaft commentedon Dec 29, 2023
@lovell Totally agree its not a good long term solution. Just needed a quick way to get back up and running. Anyway, not a
problem, happy for you to triage my comment in the way you think is best appropriate. And love your package, I've used it many times over the years, thank you :)