-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Possible bug
When sharp is used in a project that also contains specific dependencies like @tailwindcss/postcss@4.1.14 and eslint-config-next@15.5.4, it causes sharp to incorrectly detect that it is in an Emscripten environment. This leads to sharp attempting to build WebAssembly (WA) binaries during npm install, causing extraneous dependencies and confusion for users.
Furthermore, post-install scripts from napi-rs make it impossible to remove the WebAssembly binaries unless the sharp package and its node modules are completely removed from the project and dependencies are reinstalled.
This issue was first identified in a Next.js issue here [https://github.com/vercel/next.js/issues/84450#] and brought up to the maintainers of next.js where sharp was pulled in as a transitive dependency, even though there was no intention of using sharp directly.
Is this a possible bug in a feature of sharp, unrelated to installation?
- Running
npm install sharpcompletes without error. - Running
node -e "require('sharp')"completes without error.
Are you using the latest version of sharp?
- I am using the latest version of
sharpas reported bynpm view sharp dist-tags.latest.
If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.
If you are using another package which depends on a version of sharp that is not the latest, please open an issue against that package instead.
Does this problem relate to file caching?
The default behavior of libvips is to cache input files, which can lead to EBUSY or EPERM errors on Windows.
Use [sharp.cache(false)](https://sharp.pixelplumbing.com/api-utility#cache) to switch this feature off.
- Adding
sharp.cache(false)does not fix this problem.
Does this problem relate to images appearing to have been rotated by 90 degrees?
Images that contain EXIF Orientation metadata are not auto-oriented. By default, EXIF metadata is removed.
-
To auto-orient pixel values use the parameter-less
[rotate()](https://sharp.pixelplumbing.com/api-operation#rotate)operation. -
To retain EXIF Orientation use
[keepExif()](https://sharp.pixelplumbing.com/api-output#keepexif). -
Using
rotate()orkeepExif()does not fix this problem.
What are the steps to reproduce?
-
Install Node.js project with
eslint-config-next@15.5.4or@tailwindcss/postcss@4.1.14. -
Install
sharpeither directly or as a transitive dependency (vianext.js). -
install next.js via npx create-next-app and select
tailwindoreslint. -
then run
npm ls
Alternatively: -
Install a Node.js project with
sharpand@tailwindcss/postcss@4.1.14. -
Install a Node.js project with
sharp,@tailwindcss/postcss@4.1.14, andeslint-config-next@15.5.4` -
then run
npm ls
What is the expected behavior?
A clean installation of dependencies without the extraneous dependencies or unneeded WebAssembly binaries or post-install scripts altering the project.
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
See here: vercel/next.js#84450
Please provide sample image(s) that help explain this problem
There is no need for images for this issue to arise.