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 optional binaries not included in .output #1257

Open
Aareksio opened this issue Feb 20, 2024 · 5 comments
Open

sharp optional binaries not included in .output #1257

Aareksio opened this issue Feb 20, 2024 · 5 comments

Comments

@Aareksio
Copy link
Contributor

Aareksio commented Feb 20, 2024

Reproduction

git clone git@github.com:nuxt/image.git
cd image
pnpm install
pnpm dev:prepare
pnpm build
pnpm dev:build
rm -rf node_modules/@img
node playground/.output/server/index.mjs

Open: http://localhost:3000/provider/ipx


[500] [IPX_ERROR] Could not load the "sharp" module using the ... runtime

Sharp binaries, bundled as @img/sharp-*, are not included in generated .output. Tests may pass, because of module resolution. We need to isolate .output (or delete root project node_modules, as with reproduction), as it should be done in production.

Related: lovell/sharp#4000 (cross architecture build)
Related: #1237, #1210 (either cross architecture build or isolating .output)
Related: #1253 (both cross architecture build and isolating .output)


Workaround before this gets fixed: downgrade sharp to 0.32.6 via your package manager.

@tasiotas
Copy link

I couldn't get it working with pnpm and supportedArchitectures. Had to go back to Yarn... 😟

@alimozdemir
Copy link

This is a blocker for me right now, either I will remove nuxt-image or I will find a workaround with pnpm. It is very annoying

@juane1000
Copy link

The latest update (1.4.0) shoots my server build to 50MB+ from ~12-ishh. Is this intentional/desirable? Seem exorbitant. I was unaware that the the plugin included resizing functionality. Is there an option to exclude the "sharp" dependency from the server bundle and have it installed in the deployment server environment? Thanks.

@DamianGlowala
Copy link
Member

DamianGlowala commented Apr 9, 2024

Has anyone found a workaround with pnpm? This is also a blocker for me at the moment.

UPDATE: added sharp 0.33.3 to overrides and it works correctly.

@oripka
Copy link

oripka commented Apr 26, 2024

Has anyone found a workaround with pnpm? This is also a blocker for me at the moment.

UPDATE: added sharp 0.33.3 to overrides and it works correctly.

This is the only fix that worked for me, everything else described even using the latest nuxt image version failed when deploying a nuxt project built on m1 to a linux x64 server.

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