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

Sharp.js v0.33 not working in combination with pnpm #11220

Open
ZoranRavic opened this issue Mar 3, 2024 · 0 comments
Open

Sharp.js v0.33 not working in combination with pnpm #11220

ZoranRavic opened this issue Mar 3, 2024 · 0 comments

Comments

@ZoranRavic
Copy link

Starting with version 0.33.0 sharp made a major overhaul of installation where they changed how prebuilt binaries are installed.

This introduced an issue on Vercel where if you are using pnpm then the prebuilt binaries for sharp 0.33.x wont be included in the deployment build and you'll end up with this error message:

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:
- Add platform-specific dependencies:
    npm install --os=linux --cpu=x64 sharp
  or
    npm install --force @img/sharp-linux-x64
- Consult the installation documentation: https://sharp.pixelplumbing.com/install
    at Object.<anonymous> (/var/task/node_modules/.pnpm/sharp@0.33.0/node_modules/sharp/lib/sharp.js:85:9)
    at Module._compile (node:internal/modules/cjs/loader:1356:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
    at Module.load (node:internal/modules/cjs/loader:1197:32)
    at Module._load (node:internal/modules/cjs/loader:1013:12)
    at exports.b (/opt/node-bridge/chunk-5UAC7W5H.js:1:1142)
    at /opt/node-bridge/bridge-server-BGIDXK2J.js:1:1443
    at Function.Re (/opt/node-bridge/bridge-server-BGIDXK2J.js:1:1809)
    at e.<computed>.L._load (/opt/node-bridge/bridge-server-BGIDXK2J.js:1:1413)
    at Module.require (node:internal/modules/cjs/loader:1225:19) {
  page: '/api/compress'
}

As a workaround you can downgrade sharp to 0.32.6.

Alternatively you can use npm instead of pnpm, which will allow you to continue using the latest versions of sharp.

Hopefully someone from Vercel will see this and find a way to resolve the issue with using pnpm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant