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.31k stars 1.3k forks source link

Prebuilt binaries are not being fetched correctly #4275

Closed LunaticMuch closed 1 day ago

LunaticMuch commented 2 days ago

Possible install-time or require-time problem

I am installing strapi which requires sharp. As I am in a corporate environment, I use an internal repository which contains a copy of prebuilt binaries for libs and sharp. In my .npmrc I have sharp_libvips_binary_host and sharp_binary_host but the installer does not pull anything from there. Actually the installer seems to append the URL to the local past of my installation

You must confirm both of these before continuing.

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.

Are you using a supported runtime?

Are you using a supported package manager and installing optional dependencies?

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

> sharp@0.32.6 install
> (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)

sharp: Using local libvips from /Users/stefano/_TEST/my-strapi-project/node_modules/@strapi/upload/node_modules/sharp/https:/myartifactoryhost/artifactory/gen-repo/node-libs/sharp/v8.14.5/libvips-8.14.5-darwin-arm64v8.tar.br
sharp: Installation error: ENOENT: no such file or directory, open '/Users/stefano/_TEST/my-strapi-project/node_modules/@strapi/upload/node_modules/sharp/https:/myartifactoryhost/artifactory/gen-repo/node-libs/sharp/v8.14.5/libvips-8.14.5-darwin-arm64v8.tar.br'

This is my .npmrc

sharp_libvips_binary_host=https://myartifactoryhost/artifactory/gen-repo/node-libs/sharp/
sharp_binary_host=https://myartifactoryhost/artifactory/gen-repo/node-libs/sharp/
npm_config_sharp_libvips_binary_host=https://myartifactoryhost/artifactory/gen-repo/node-libs/sharp/

My env

  System:
    OS: macOS 15.0.1
    CPU: (12) arm64 Apple M3 Pro
    Memory: 1.89 GB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.16.0 - /opt/homebrew/opt/nvm/versions/node/v20.16.0/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.8.1 - /opt/homebrew/opt/nvm/versions/node/v20.16.0/bin/npm
    pnpm: 9.7.1 - /opt/homebrew/bin/pnpm
lovell commented 1 day ago

sharp@0.32.6 install

Please upgrade to the latest version.

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.

LunaticMuch commented 1 day ago

Can't understand how does work...but npm install sharp@0.32.6 produces the exact same issue, appending the host to URL

npm error command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm error sharp: Using local libvips from /Users/stefano/_TEST/t2/node_modules/sharp/https:/myartifactoryhost/artifactory/gen-repo/node-libs/sharp/v8.14.5/libvips-8.14.5-darwin-arm64v8.tar.br
npm error sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm error
lovell commented 1 day ago

The latest version is v0.33.5, please upgrade.