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

Uncaught Error: Could not load the "sharp" module using the linux-x64 runtime #3911

Closed
5 of 11 tasks
mykola-mokhnach opened this issue Dec 21, 2023 · 9 comments
Closed
5 of 11 tasks

Comments

@mykola-mokhnach
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 >= 9.6.5 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 output of running npm install --verbose --foreground-scripts sharp in an empty directory?

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

Unfortunately I cannot provide the output above as the script is running as part of CI job. Although this is the output we get after bumping sharp version to 0.33.1:

     Uncaught Error: Could not load the "sharp" module using the linux-x64 runtime
ERR_DLOPEN_FAILED: libvips-cpp.so.42: cannot open shared object file: No such file or directory
Possible solutions:
- Ensure optional dependencies can be installed:
    npm install --include=optional sharp
    yarn add sharp --ignore-engines
- Ensure your package manager supports multi-platform installation:
    See https://sharp.pixelplumbing.com/install#cross-platform
- Add platform-specific dependencies:
    npm install --os=linux --cpu=x64 sharp
    npm install --force @img/sharp-linux-x64
- Consult the installation documentation:
    See https://sharp.pixelplumbing.com/install
      at Object.<anonymous> (/home/runner/work/appium/appium/node_modules/sharp/lib/sharp.js:107:9)
      at Module._compile (node:internal/modules/cjs/loader:1376:14)
      at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
      at Object.require.extensions.<computed> [as .js] (/home/runner/work/appium/appium/node_modules/ts-node/src/index.ts:1608:43)
      at Module.load (node:internal/modules/cjs/loader:1207:32)
      at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
      at Module.require (node:internal/modules/cjs/loader:1235:19)
      at require (node:internal/modules/helpers:176:18)
      at Object.<anonymous> (/home/runner/work/appium/appium/node_modules/sharp/lib/constructor.js:10:1)
      at Module._compile (node:internal/modules/cjs/loader:1376:14)

The link to the CI job: appium/appium#19547

Exactly the same CI script worked completely fine with version 0.33.0, so it seems like there is some regression in v. 0.33.1

@lovell
Copy link
Owner

lovell commented Dec 21, 2023

The PR appears to be updating multiple packages to sharp 0.33.1 from both 0.32.6 and 0.33.0. I can see there are still entries for 0.33.0 in the lockfile after the update so please can you ensure the lockfile has been regenerated properly.

It looks like you're using a cached node_modules and a lockfile when npm install is run so you might have hit npm/cli#4828

@mykola-mokhnach
Copy link
Author

Thank you for your reply Lovell

I have updated the lockfile, although this did not do any visible improvements.
I will try to disable caching as the next step

@chaselen

This comment was marked as off-topic.

1 similar comment
@JMH0113

This comment was marked as off-topic.

@mykola-mokhnach
Copy link
Author

Seems like bumping all monorepo packages to v0.33.0 first did the trick and now the CI succeeds: https://github.com/appium/appium/actions/runs/7304747517/job/19907366251

Thanks for your help @lovell

@Nantris
Copy link

Nantris commented Jan 20, 2024

Sorry for the slightly off topic comment. I'm wondering what version of Sharp bumped the minimum yarn version to 3.2.x?

We're facing this same issue and I'm happy to open an issue, but if Yarn 1.22 isn't supported I won't waste anyone's time with it. I'm just wondering when this change occurred since 0.32.x worked great still with Yarn 1.22.

I was hoping to upgrade to fix this issue: expo/eas-cli#1728

(Of course I'm happy to upgrade Yarn too, but I'm already 4 problems deep at the moment and don't want to be changing more variables.)

@lovell
Copy link
Owner

lovell commented Jan 21, 2024

@slapbox There are many reasons to stop using yarn v1 but if you have no other choice then it requires an additional flag to install an increasing number of native modules, including sharp v0.33.0+.

https://sharp.pixelplumbing.com/install

yarn v1 (maintenance mode)
yarn add sharp --ignore-engines

@emptyflask
Copy link

@slapbox There are many reasons to stop using yarn v1 but if you have no other choice then it requires an additional flag to install an increasing number of native modules, including sharp v0.33.0+.

sharp.pixelplumbing.com/install

yarn v1 (maintenance mode)
yarn add sharp --ignore-engines

This is an old, closed ticket, but shouldn't a breaking change like this bump the package to a new major version?

@Nantris
Copy link

Nantris commented Feb 28, 2024

For a pre-v1 package it's totally normal to do minor version bumps for breaking changes.

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

6 participants