Repository navigation
Description
Description
When running Ubuntu 24.04 LTS on WSL2, sharp is missing avif format / sharp cannot use binaries for avif format:
// on node shell (installed sharp with npm, then run `node` inside `./node_modules/` )
// this returns undefined
require('sharp').format.avifi'm using nvm, so maybe this is related to #3884 ?...
Possible install-time or require-time problem
- I have read and understood all of the documentation relating to installation.
- I have searched for known bugs relating to this problem in my choice of package manager.
Are you using the latest version of sharp?
- I am using the latest version of
sharpas reported bynpm view sharp dist-tags.latest: yes0.34.5.
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: yesv22.21.1
Are you using a supported package manager and installing optional dependencies?
- I am using npm >= 10.1.0 with
--include=optional: yes, installed withnpm install sharp --include=optional(npmv10.9.4)
What is the complete error message, including the full stack trace?
N/A (no there is no error)
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 verbose cli /home/gaba/.nvm/versions/node/v22.21.1/bin/node /home/gaba/.nvm/versions/node/v22.21.1/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/gaba/.npm/_logs/2025-12-09T22_24_27_910Z-
npm verbose logfile /home/gaba/.npm/_logs/2025-12-09T22_24_27_910Z-debug-0.log
npm http cache https://registry.npmjs.org/sharp 12ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-arm64 227ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/detect-libc 237ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/semver 240ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-riscv64 254ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-darwin-arm64 257ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-ppc64 257ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fcolour 267ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-arm 273ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-darwin-x64 278ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-darwin-x64 281ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-darwin-arm64 298ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-x64 90ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-arm64 70ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linuxmusl-x64 74ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-arm 90ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linuxmusl-arm64 107ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-ppc64 83ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-x64 70ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-s390x 75ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linuxmusl-arm64 82ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-wasm32 81ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linuxmusl-x64 89ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-riscv64 154ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-win32-x64 80ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-win32-arm64 101ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-win32-ia32 2380ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-s390x 2778ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@emnapi%2fruntime 70ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/tslib 52ms (cache revalidated)
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-win32-x64
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-win32-ia32
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-win32-arm64
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-wasm32
npm verbose reify failed optional dependency /home/gaba/node_modules/@emnapi/runtime
npm verbose reify failed optional dependency /home/gaba/node_modules/tslib
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-linuxmusl-x64
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-linuxmusl-arm64
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-linux-s390x
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-linux-riscv64
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-linux-ppc64
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-linux-arm64
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-linux-arm
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-libvips-linuxmusl-x64
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-libvips-linuxmusl-arm64
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-libvips-linux-s390x
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-libvips-linux-riscv64
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-libvips-linux-ppc64
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-libvips-linux-arm64
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-libvips-linux-arm
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-libvips-darwin-x64
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-libvips-darwin-arm64
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-darwin-x64
npm verbose reify failed optional dependency /home/gaba/node_modules/@img/sharp-darwin-arm64
npm http cache tslib@https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz 0ms (cache hit)
npm http cache semver@https://registry.npmjs.org/semver/-/semver-7.7.3.tgz 0ms (cache hit)
npm http cache @img/sharp-linux-x64@https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.34.5.tgz 0ms (cache hit)
npm http cache detect-libc@https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz 0ms (cache hit)
npm http cache @img/sharp-libvips-linux-x64@https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.2.4.tgz 0ms (cache hit)
npm http cache @img/colour@https://registry.npmjs.org/@img/colour/-/colour-1.0.0.tgz 0ms (cache hit)
npm http cache @emnapi/runtime@https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.7.1.tgz 0ms (cache hit)
npm http cache sharp@https://registry.npmjs.org/sharp/-/sharp-0.34.5.tgz 0ms (cache hit)
npm info run [email protected] install node_modules/sharp node install/check.js || npm run build
> [email protected] install
> node install/check.js || npm run build
npm info run [email protected] install { code: 0, signal: null }
added 6 packages in 4s
3 packages are looking for funding
run `npm fund` for details
npm verbose cwd /home/gaba
npm verbose os Linux 6.6.87.2-microsoft-standard-WSL2
npm verbose node v22.21.1
npm verbose npm v10.9.4
npm verbose exit 0
npm info ok
What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?
$ npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
System:
OS: Linux 6.6 Ubuntu 24.04.3 LTS 24.04.3 LTS (Noble Numbat)
CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
Memory: 6.95 GB / 7.72 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 22.21.1 - /home/gaba/.nvm/versions/node/v22.21.1/bin/node
npm: 10.9.4 - /home/gaba/.nvm/versions/node/v22.21.1/bin/npm
pnpm: 10.20.0 - /home/gaba/.local/share/pnpm/pnpm
npmPackages:
sharp: ^0.34.5 => 0.34.5
npmGlobalPackages:
sharp: 0.34.5
Extra info
extra info:
output of pkg-config libheif --print-variables
$ pkg-config libheif --print-variables
builtin_avif_encoder
builtin_avif_decoder
builtin_h265_encoder
builtin_h265_decoder
includedir
libdir
exec_prefix
prefix
pcfilediroutput of readelf -d node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.17.3`
```bash
$ readelf -d node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.17.3
Dynamic section at offset 0xf74060 contains 34 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libresolv.so.2]
0x0000000000000001 (NEEDED) Shared library: [libdl.so.2]
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0]
0x0000000000000001 (NEEDED) Shared library: [libm.so.6]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x0000000000000001 (NEEDED) Shared library: [ld-linux-x86-64.so.2]
0x000000000000000e (SONAME) Library soname: [libvips-cpp.so.8.17.3]
0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN/]
0x000000000000000c (INIT) 0x10a000
0x000000000000000d (FINI) 0xb84b18
0x0000000000000019 (INIT_ARRAY) 0xecf370
0x000000000000001b (INIT_ARRAYSZ) 600 (bytes)
0x000000000000001a (FINI_ARRAY) 0xecf5c8
0x000000000000001c (FINI_ARRAYSZ) 24 (bytes)
0x000000006ffffef5 (GNU_HASH) 0x298
0x0000000000000005 (STRTAB) 0x1c398
0x0000000000000006 (SYMTAB) 0x5730
0x000000000000000a (STRSZ) 88883 (bytes)
0x000000000000000b (SYMENT) 24 (bytes)
0x0000000000000003 (PLTGOT) 0xf76000
0x0000000000000002 (PLTRELSZ) 10896 (bytes)
0x0000000000000014 (PLTREL) RELA
0x0000000000000017 (JMPREL) 0x106ba0
0x0000000000000007 (RELA) 0x34090
0x0000000000000008 (RELASZ) 862992 (bytes)
0x0000000000000009 (RELAENT) 24 (bytes)
0x000000006ffffffb (FLAGS_1) Flags: NODELETE
0x000000006ffffffe (VERNEED) 0x33d30
0x000000006fffffff (VERNEEDNUM) 8
0x000000006ffffff0 (VERSYM) 0x31ecc
0x000000006ffffff9 (RELACOUNT) 35455
0x0000000000000000 (NULL) 0x0
</details>
output of `pkg-config --modversion vips-cpp`: 8.15.1
Activity
jgabriel98 commentedon Dec 9, 2025
Feel free to ask for any extra info you guys need!
lovell commentedon Dec 9, 2025
jgabriel98 commentedon Dec 9, 2025
oh...
thanks, will check if i'm able to compress a file!
If it goes well, i'll close the issue!
jgabriel98 commentedon Dec 9, 2025
Ok, i did some debugging while trying to compress a file and the real problem was Sharp
.metadata():when creating a
.aviffile like this:then opening it with sharp, like this:
The
metadata().formatwasheifinstead ofavif:And that caused my code to handle it with
.heif()instead of.avif(), and since Sharp.avifdoes not required the options fieldcompression, but.heif()does,i got the error:
TL;DR:
sharp().metadata().formatreturns "heif" for avif file instead of "avif",and that caused code logic to handle the file with
sharp().heif(), resulting in errors (because.heif()requires extra parameters/options)jgabriel98 commentedon Dec 9, 2025
@lovell question: should i open a new issue or this is the expected behavior?
Docs: clarify metadata 'format' property #4483
lovell commentedon Dec 10, 2025
This is the expected behaviour as
heifis the container andav1(in thecompressionproperty) is the codec, which together are often found in a HEIF file with an.avifextension.I've updated the docs via commit 084a30f to help clarify that
formatrelates more to parsing than decompression.jgabriel98 commentedon Dec 10, 2025
Got it. I'll close the issue now. Thanks!