-
-
Notifications
You must be signed in to change notification settings - Fork 932
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
Error: Could not load the "sharp" module using the linux-x64 runtime[Fixed] #2858
Comments
Vendure suppose to work with even numbers of nodejs as stated in the documentation. (https://docs.vendure.io/guides/getting-started/installation/ first bullet) |
I don't think it's a node version issue, I switched to each version listed whilst debugging and no difference. Seems to be a problem with my package manager fetching the wrong sharp binary |
I understand, still a lot of people have the same problem under the sharp repo. lovell/sharp#3870 (comment) solved by correct version. |
This issue has completely taken out my build.
I am currently running into the same issue. Replacing the SharpAssetPreviewStrategy does not work either. I've gotten it to work locally a few times, but I couldn't tell you how I did. My node versions are correct. It definitely seems as if it's an issue with the way it detects dependencies. I'm using yarn btw |
What fixed this for me, was updating my version of yarn. |
I'd love to make a PR for it! I'll look into it, add my solution (although I'm sure there's a more eloquent way of forcing sharp to pick the right binary via the package.json, although I haven't found a solution ) And I'll add @TonyRice solution to update yarn above. Tony, do you mind if I loop you into the PR to elaborate on your solution? Glad updating yarn worked for you! I tried updating pnpm and npm but I'm up to date with both so no dice, gonna probs add a post install script into my repo to specifically install sharp for my OS |
I'm assuming changing node version is the correct solution and I'm dealing with some WSL weirdness, I'll add my solution as an unrecommended solution |
Created PR here :D |
Describe the bug
Using pnpm in linux to install Vendure, I came across this error after the install script, changing npm to pnpm in the package.json and running
pnpm dev
My node version was good etc. I'm thinking it's a problem with how WSL is configured as sharp seemed to be fetching the wrong binaries.
I was able to fix this problem by running
pnpm install sharp --config.platform=linux --config.architecture=x64
This let me run the the server like normal :)
I wonder if this could be prevented in the package.json somehow, or adding a little debug statement to prompt the user to try installing sharp with the specific config above, if we fail to import sharp in (p)npm dev
Failing that, a line in the readme would be nice :)
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The server to start up normally
Environment (please complete the following information):
Additional context
WSL linux distro:
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
The text was updated successfully, but these errors were encountered: