Open meyvan opened 1 month ago
Install sharp if you are using asset server strategy:
npm install --include=optional sharp
or
yarn add sharp --ignore-engines
Install sharp if you are using asset server strategy:
npm install --include=optional sharp
oryarn add sharp --ignore-engines
Mate two things:
SharpAssetPreviewStrategy
, im using the S3AssetStorageStrategy
My question is why is included as part of core packages ? Since the entire architecture is strategy based why not let the end user install it IF AND ONLY IF they use SharpAssetPreviewStrategy
?
Install sharp if you are using asset server strategy:
npm install --include=optional sharp
oryarn add sharp --ignore-engines
It's a mess when doing automated builds because you depend on what's defined in package.json
Hi @meyvan, thanks for the report
Regarding the error itself, it may be the same as reported here
My question is why is included as part of core packages ? Since the entire architecture is strategy based why not let the end user install it IF AND ONLY IF they use SharpAssetPreviewStrategy ?
When you use @vendure/create
we do include some non-core plugins that (usually) make the starting experience smoother.
We do not ship any other asset preview strategy than the sharp one, which means that if we didn't include it in a standard installation, then if you try to upload images we would not be able to create previews.
Can you try updating to Node v20 and see if that makes any difference?
We do not ship any other asset preview strategy than the sharp one, which means that if we didn't include it in a standard installation, then if you try to upload images we would not be able to create previews.
Can you try updating to Node v20 and see if that makes any difference?
@michaelbromley I get it.
But here is my visible confusion:
I see previews being made as optional params, which led me to assume, those are in fact optional
Second, the left panel shows Sharp Preview Strategy similar to AssetStorage and LocalStorage and underneath it. It led me to believe SharpPreview is a separate strategy and not part of Assets Storage.
Maybe can it be included as a submenu underneath AssetStorageStragety ?
I was under the assumption that if no preview related configurations are sent in, then no image will be transformed
Still getting the same error mate, tried 20 and 22
Got it. To anyone who is using windows, use the below for local development and make sure to install the linux based when you are deploying. Not a great solution but the bug from Sharp as mentioned by @michaelbromley makes it as a necessity
npm install sharp
npm install --force @img/sharp-win32-x64
@meyvan please reopen it. I'm experiencing the same issue on a linux machine, and I think having a long term solution helps.
@michaelbromley it breaks between version 2.1.9 and 2.2.0. I had to upgrade from an earlier version to use a plugin and ran into this error.
in v2.2.0 we upgraded the Sharp version, which is why the issue now appears.
I think a work-around could be that we add the --include=optional
flag in the @vendure/create
install command. The strange thing is that I don't run into this when testing locally. I'll have to see how I can reproduce and therefore test any fixes.
Some thoughts on reproducing the error:
npm install --cpu=x64 --os=linux --libc=glibc sharp
and npm install --include=optional sharp
Describe the bug When I try to create a new installation by following https://docs.vendure.io/guides/getting-started/installation/ guide I get the followinf error:
To Reproduce Steps to reproduce the behavior:
npm run dev
Expected behavior Should run smoothly
Environment (please complete the following information):
Additional context
Sharp is only required if someone is using this strategy: https://docs.vendure.io/reference/core-plugins/asset-server-plugin/sharp-asset-preview-strategy
Why install it in the first place ? If someone wants to use it, let them install and use the strategy
Proposed Solution: Remove Sharp library as default and update docs to reflect the same