-
Notifications
You must be signed in to change notification settings - Fork 27k
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 no longer optional since 10.0.4-canary.7 #20456
Comments
Perhaps a CI test that removes |
Feel free to send a PR! |
Tks for the report and PR @jorrit !
I don't really know why but this happens in 10.0.4 (the latest version, not the canary one) too |
Canary-7 was the version the bug got introduced in, it is also in the later canary versions and the final version. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Workaround for vercel/next.js#20456
same issue. could not deploy to aws |
is there a temporary fix for this? |
Downgrading to `{"next": "10.0.3"}` worked wonders for me
|
thank you much brother! unfortunately, it didn't work. I spent 8 hours trying to make this work on the beanstalk. no luck |
Any update on this? This introduces so many new dependencies that previous docker images fail to build because this now requires sharp which reuqires python3 and so on. This currently prevents us from upgrading to the latest next.js version |
For macos users: Also, don't forget to upgrade it if it exists already! |
@genemators If only that was that easy. What about corporate environments that just can't download things from the internet for builds, only from an npm mirror ? |
I dunno dude, this is just a temporary solution. |
Having "sharp" as a dependency is a bit of a problem on corporate systems because those terminals usually aren't allowed to fetch anything directly from GitHub which is exactly what the sharp install keeps trying to do. Related StackOverflow thread: |
This pull request removes the native `sharp` dependency (which doesn't work on some Linux variants, nor **M1 Mac**) and replaces it with a wasm equivalent. It also reduces Next.js' installed size by 27.3 MB. The code is adapted from the [Squoosh CLI](https://github.com/GoogleChromeLabs/squoosh). This PR still supports: - Rotation normalization - Resizing - PNG - JPEG - Webp However, it (temporarily) removes support for: - Resizing Gifs - Resizing Tiff (these formats still get served and rendered correctly by the image component) --- Fixes #20456 Closes #20738 Closes #21762
Thanks for kodiakhq for the effort to replace sharp, but this was closed and the problem persist in the latest version. Best regards. |
@robertveloso A new stable version hasn't yet been released since the fix, but if you install the latest preview version (currently |
Thank you @genemators :D now im downloading all the deep web and google server files on my desktop <3 |
Bruh, it was just an option ... |
For Arch Linux (or Arch Linux based distro likes Manjaro), try |
Doesn't work in mac. |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
Next.js has an optional dependency on sharp. This means that it should run without sharp present in node_modules.
PR #20035 broke this by adding
require.resolve('sharp')
without a try/catch to catchMODULE_NOT_FOUND
.I discovered this because sharp no longer installs with NPM 7 (see #20432).
To Reproduce
npm i [email protected]
rimraf node_modules/sharp
npm run build
Expected behavior
The site builds OK.
The text was updated successfully, but these errors were encountered: