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

Could not load the \"sharp\" module using the linux-x64 runtime\nPossible #40

Closed
eyyazubi opened this issue May 1, 2024 · 6 comments
Closed

Comments

@eyyazubi
Copy link

eyyazubi commented May 1, 2024

i got:

"errorType": "Error",
"errorMessage": "Could not load the "sharp" module using the linux-x64 runtime\nPossible solutions:\n- Ensure optional dependencies can be installed:\n npm install --include=optional sharp\n yarn add sharp --ignore-engines\n- Ensure your package manager supports multi-platform installation:\n See https://sharp.pixelplumbing.com/install#cross-platform\n- Add platform-specific dependencies:\n npm install --os=linux --cpu=x64 sharp\n- Consult the installation documentation:\n See https://sharp.pixelplumbing.com/install"...

and fixed with root package.json
line 8:
prev:
"prebuild": "npm install sharp --prefix functions/image-processing/ --os=linux --cpu=x64"

TO:
"prebuild": "npm install --force sharp --prefix functions/image-processing/ --os=linux --cpu=x64"

@achrafsouk
Copy link
Contributor

It did not work for me (i am using Mac)

@eyyazubi
Copy link
Author

eyyazubi commented May 1, 2024

I also use mac. I haven't tested it at all on the mac. It comes in Lambda functions on aws.

i had a "internal error" message, when i try visit to the images via cloudfront url and saw the error in the lambda functions under code source.

found this post regarding sharp and linux-x64 runtime:
lovell/sharp#4001

@maiconcarraro
Copy link
Contributor

I had this error because I deployed without running the build before, after running the build it was working fine. I'm using node v22 and npm 10.6.0.

@dimasxp
Copy link

dimasxp commented May 11, 2024

have the same problem, changed node version from 18 to 20,rebuild, now works fine

@ishanaudichya
Copy link

It did not work for me (i am using Mac)

I think u re using an arm machine so the binary for sharp are not created
image

This will work fine on x86 machines. To get around this use post build instead of prebuild in package.json
image

Like this and it will work fine.
Lmk if it works out.

@bracki
Copy link

bracki commented Jun 13, 2024

Switched to Node 20 from 18. Now it works. 🎉

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

6 participants