lovell / sharp

High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
https://sharp.pixelplumbing.com
Apache License 2.0
29.01k stars 1.29k forks source link

prebuilds fail on alpine linux edge #3641

Closed selfisekai closed 1 year ago

selfisekai commented 1 year ago

the version in the error log is the version of musl that is currently deployed on edge only. works without using prebuilds (after apk add vips-dev)

Possible install-time or require-time problem

Are you using the latest version of sharp?

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.

Is this a problem with filesystem permissions?

no

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

``` npm info run sharp@0.32.0 install node_modules/sharp (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy) > sharp@0.32.0 install > (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy) sharp: Installation error: Invalid Version: 1.2.3_git20230411tall node_modules/sharp (node install/libvips && node install/dll-copy sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies npm info run sharp@0.32.0 install { code: 1, signal: null } npm verb stack Error: command failed npm verb stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27) npm verb stack at ChildProcess.emit (node:events:513:28) npm verb stack at maybeClose (node:internal/child_process:1091:16) npm verb stack at ChildProcess._handle.onexit (node:internal/child_process:302:5) npm verb pkgid sharp@0.32.0 npm verb cwd /tmp/11219 npm verb Linux 6.1.25-0-lts npm verb node v18.16.0 npm verb npm v9.6.4 npm ERR! code 1 npm ERR! path /tmp/11219/node_modules/sharp npm ERR! command failed npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy) npm verb exit 1 npm verb unfinished npm timer reify 1682091025295 npm verb unfinished npm timer reify:build 1682091027750 npm verb unfinished npm timer build 1682091027750 npm verb unfinished npm timer build:deps 1682091027751 npm verb unfinished npm timer build:run:install 1682091027759 npm verb unfinished npm timer build:run:install:node_modules/sharp 1682091027759 npm verb code 1 npm ERR! A complete log of this run can be found in: /home/lauren/.npm/_logs/2023-04-21T15_30_25_244Z-debug-0.log ```

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

  System:
    OS: Linux 6.1 Alpine Linux
    CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
    Memory: 2.94 GB / 15.29 GB
    Container: Yes
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.16.0 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 9.6.4 - /usr/bin/npm
lovell commented 1 year ago

It looks like Alpine Edge (temporarily?) switched to using an unstable version of musl last week:

https://gitlab.alpinelinux.org/alpine/aports/-/commit/bd758e828afaa840262f174077c151cd9c5ded04

The underscore in the version identifier means it no longer semver-valid.

Perhaps you could ask upstream if Alpine might consider using a + to separate build information instead, e.g. 1.2.3+git20230411? Otherwise I'll need to address this in detect-libc.

selfisekai commented 1 year ago

it would be incompatible with both abuild and apk-tools schemes. https://wiki.alpinelinux.org/wiki/APKBUILD_Reference#pkgver

afaik the goal for 3.18 release is to bump it up to 1.2.4, so it's just the current edge being affected

I think I'd just do .replace('_', '+') on the version

lovell commented 1 year ago

v0.32.1 now available, which now attempts to coerce the libc version into semver compliance. Thanks for reporting this.