-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Cannot run a packaged electron forge app #4116
Comments
Looking at https://github.com/neocrao/electron-forge-sharp
|
Hello @lovell! Thank you for the suggestion. Unfortunately, it doesn't seem to work. Commit: neocrao/electron-forge-sharp@08b6cb5 Overall changes since
|
Looks like |
Update: neocrao/electron-forge-sharp@67c6331 Still fails with similar error:
I also performed the following to make sure it was in a clean state, but ended with the same error as above.
|
Ah, I remember now, this is due to electron/forge#1250 and came up previously in #3640 (comment) You'll probably want to use @timfish/forge-externals-plugin until electron-forge fixes this. |
I did try this @timfish/forge-externals-plugin (neocrao/electron-forge-sharp@311d5e6) But while working with you, I started questioning the glob pattern that I put in for asar unpack, and it turned out that it was the issue. - unpack: "(**/node_modules/sharp/**/*|**/node_modules/@img/**/*)"
+ unpack: "**/node_modules/{sharp,@img}/**/*" As a summary, below are the details on whats required to make Setup steps:
Thank you so much for the help! Please feel free to close this issue. |
Isn't this approaching including prebuilds for ALL platforms into the final package? I'm looking for a way to include only the prebuilt files for the specific target platform, so that the package is not getting too big unnecessarily. |
This solution fixed a very similar problem I was having in Windows.
The step for updating packagerConfig: {
- asar: true,
- "asarUnpack": [
- "**/node_modules/sharp/**/*",
- "**/node_modules/@img/**/*"
- ]
+ asar: {
+ unpack: "**/node_modules/{sharp,@img}/**/*"
}
}, |
Update install documentation for Electron Renamed the previous Electron section to 'electron-builder' and fixed the broken external link Added a new section for 'electron-forge' with its own external link to electron-forge documentation and included sharp ASAR configuration. The config for 'electron-forge' is based on part of the resolution in lovell#4116
I can't believe I just spent 3 hours trying to get this to work cause I didn't notice the difference between:
and
Also it wasn't clear above if you needed @timfish/forge-externals-plugin but for me I did - I tested after I saw my mistake and without it I get an error it can't find sharp. my forge.config.js file:
this was a handy way to see if the file existed:
thanks so much for maintaining this, it is much appreciated. |
@rdyar Thank you, you saved my day! I spent five hours looking for the cause, and your solution really worked for me. |
Possible install-time or require-time problem
You must confirm both of these before continuing.
Are you using the latest version of sharp?
sharp
as 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.
Are you using a supported runtime?
^18.17.0 || ^20.3.0 || >=21.0.0
If you cannot confirm any of these,
please upgrade to the latest version
and try again before opening an issue.
Are you using a supported package manager and installing optional dependencies?
--include=optional
--no-optional=false
If you cannot confirm any of these, please upgrade to the latest version of your chosen package manager
and ensure you are allowing the installation of optional or multi-platform dependencies before opening an issue.
What is the complete error message, including the full stack trace?
Below are some of the things I have tried as I scoured through the the reported issues in this repository. None of the solutions worked for me. I am hoping that its something simple that I have missed.
I'd appreciate any help.
Steps to reproduce with different attempts to solve the issue:
Setup an electron forge project (neocrao/electron-forge-sharp@cb18b5d)
npm run start
andnpm run make
work without any issuesInstall
sharp
(neocrao/electron-forge-sharp@f6571bd)Use
sharp
in the project (neocrao/electron-forge-sharp@fae3202)npm run start
works.But packaging an app using
npm run make
, and then running the packaged app, gives the following error.Added
'sharp': 'commonjs sharp',
to webpack (neocrao/electron-forge-sharp@ae0088e)Packaged app with
npm run make
throws error:Added asar unpack paths (neocrao/electron-forge-sharp@1894d02)
Packaged app with
npm run make
throws error:Tried
@timfish/forge-externals-plugin
(neocrao/electron-forge-sharp@311d5e6)Packaged app with
npm run make
throws error:Tried
copy-webpack-plugin
(neocrao/electron-forge-sharp@bce90da)Packaged app with
npm run make
throws error:What is the complete output of running
npm install --verbose --foreground-scripts sharp
in an empty directory?What is the output of running
npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
?The text was updated successfully, but these errors were encountered: