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

Unable to package sharp on Windows 10 using Electron Forge with Webpack, TypeScript, and React #4333

Open
5 tasks done
ryankashi opened this issue Feb 18, 2025 · 1 comment

Comments

@ryankashi
Copy link

Possible bug

Is this a possible bug in a feature of sharp, unrelated to installation?

  • Running npm install sharp completes without error.
  • Running node -e "require('sharp')" completes without error.

If you cannot confirm both of these, please open an installation issue instead.

Are you using the latest version of sharp?

  • I am using the latest version of sharp as reported by npm 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.

What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?

Does this problem relate to file caching?

The default behaviour of libvips is to cache input files, which can lead to EBUSY or EPERM errors on Windows.
Use sharp.cache(false) to switch this feature off.

  • Adding sharp.cache(false) does not fix this problem.
    The issue is not with caching

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() operation.

  • To retain EXIF Orientation use keepExif().

  • Using rotate() or keepExif() does not fix this problem.
    The issue is not with rotating

What are the steps to reproduce?

Please see the following minimal example:
https://github.com/ryankashi/sharp-electron-issue

Create an electron app (tested on Windows 10), using electron-forge, webpack, typescript, and react
https://www.electronforge.io/guides/framework-integration/react-with-typescript

Update build instructions for electron+webpack located at:
https://sharp.pixelplumbing.com/install

Run npm run make
Try to install the packaged application, and an error will throw.

What is the expected behaviour?

The application packages, installs, and runs correctly. Instead, the application runs as expected in development environments however fails in packaged environments

Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem

https://github.com/ryankashi/sharp-electron-issue

Please provide sample image(s) that help explain this problem

Image

@lovell
Copy link
Owner

lovell commented Feb 18, 2025

Did you see electron/forge#1250 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants