Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use custom libvips when installing with pnpm (works fine with npm) #4304

Open
5 of 11 tasks
RebeccaStevens opened this issue Dec 23, 2024 · 0 comments
Open
5 of 11 tasks

Comments

@RebeccaStevens
Copy link

Possible install-time or require-time problem

You must confirm both of these before continuing.

Are you using the latest version of sharp?

  • I am using the latest version of sharp as reported by npm 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 >= 10.1.0 with --include=optional
  • I am using yarn >= 3.2.0
  • 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 or multi-platform dependencies before opening an issue.

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

> tsx ./run.ts

/home/me/path/to/project/node_modules/.pnpm/[email protected]/node_modules/sharp/lib/output.js:90
    const stack = Error();
                  ^

Error: VipsOperation: class "jxlsave" not found
    at Sharp.toFile (/home/me/path/to/project/node_modules/.pnpm/[email protected]/node_modules/sharp/lib/output.js:90:19)
    at <anonymous> (/home/me/path/to/project/run.ts:100:30)

Node.js v22.12.0
 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.

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

Is there an equivalent to this command I can run for pnpm?

Here's the npm version's output which is all as expected:

npm verbose cli /home/me/.nvm/versions/node/v22.12.0/bin/node /home/me/.nvm/versions/node/v22.12.0/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/me/.npm/_logs/2024-12-23T09_56_59_883Z-
npm verbose logfile /home/me/.npm/_logs/2024-12-23T09_56_59_883Z-debug-0.log
npm http fetch GET 200 https://registry.npmjs.org/sharp 11ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/semver 52ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-arm 53ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/detect-libc 55ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-win32-x64 57ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-wasm32 60ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-win32-ia32 12ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-arm64 12ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-darwin-x64 17ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-s390x 12ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-darwin-arm64 11ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linuxmusl-arm64 13ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-arm 15ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-x64 16ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-darwin-x64 15ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linuxmusl-x64 8ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-arm64 15ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-s390x 12ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-darwin-arm64 11ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linuxmusl-arm64 3ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/color 133ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-x64 135ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linuxmusl-x64 110ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/color-convert 38ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/color-string 46ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/@emnapi%2fruntime 47ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/tslib 44ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/simple-swizzle 33ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/color-name 40ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/color-name 41ms (cache updated)
npm http fetch GET 200 https://registry.npmjs.org/is-arrayish 29ms (cache updated)
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/@img/sharp-win32-x64
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/@img/sharp-win32-ia32
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/@img/sharp-wasm32
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/@emnapi/runtime
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/tslib
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/@img/sharp-linuxmusl-x64
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/@img/sharp-linuxmusl-arm64
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/@img/sharp-linux-s390x
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/@img/sharp-linux-arm64
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/@img/sharp-linux-arm
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/@img/sharp-libvips-linuxmusl-x64
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/@img/sharp-libvips-linuxmusl-arm64
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/@img/sharp-libvips-linux-s390x
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/@img/sharp-libvips-linux-arm64
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/@img/sharp-libvips-linux-arm
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/@img/sharp-libvips-darwin-x64
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/@img/sharp-libvips-darwin-arm64
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/@img/sharp-darwin-x64
npm verbose reify failed optional dependency /home/me/path/to/project/node_modules/@img/sharp-darwin-arm64
npm info run [email protected] install node_modules/sharp node install/check

> [email protected] install
> node install/check

sharp: Detected globally-installed libvips v8.16.0
sharp: Attempting to build from source via node-gyp
sharp: Please add node-addon-api to your dependencies
npm info run [email protected] install { code: 0, signal: null }
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 580ms

added 11 packages, and audited 12 packages in 1s

3 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
npm verbose cwd /home/me/path/to/project
npm verbose os Linux 6.12.6-200.fsync.fc41.x86_64
npm verbose node v22.12.0
npm verbose npm  v10.9.0
npm verbose exit 0
npm info ok

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

  System:
    OS: Linux 6.12 Nobara Linux 41 (KDE Plasma)
    CPU: (8) x64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
    Memory: 17.39 GB / 31.27 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 22.12.0 - ~/.nvm/versions/node/v22.12.0/bin/node
    npm: 10.9.0 - ~/.nvm/versions/node/v22.12.0/bin/npm
    pnpm: 9.15.1 - ~/.nvm/versions/node/v22.12.0/bin/pnpm
    bun: 1.1.8 - ~/.bun/bin/bun
  npmPackages:
    sharp: 0.33.5 => 0.33.5 

Workaround

Adding this to my package.json seems to force things to work right.

"pnpm": {
  "ignoredOptionalDependencies": [
    "@img/sharp-libvips-*"
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant