-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Wrong module versions used in packaged app, causing it to fail to load #8519
Comments
Can you try to repro on |
I forgot to mention it but I already tried, and the issue is still there. |
Looking at the linked issue, you mentioned that it doesn't occur in 25.0.0, but does in 25.0.1. This may be the offending PR then since it's related to the module dependency tree resolution changes in upstream dependency app-builder-bin @beyondkmp can you take a look at this when you have a chance since it looks to be related to app-builder? |
We get the same issue after upgrading to 25.x from 24.x in our CI pipeline. Weirdly only on macOS/Linux builds so far, and mostly different dependencies, varies from build to build. |
@giladgd I have confirmed that this MR(develar/app-builder#138) can fix this issue. |
i had a somewhat similar issue here i think ...has similar 'wrong version of dependency' used/installed in deep node_modules folder with multiple versions of things.... #8503 my question is how is the node_modules folder being constructed, is it much different than before and why the change? the "varies from build to build" is quite strange also! |
@giladgd deploying release v25.1.6 now. Please update when you have a chance |
I'm having a similar issue with Electron 24.13.3 on a yarn berry mono repo with hoisted dependencies: Root folder:
When standing inside I think this is the same issue as #4516 (electron v21) and so I don't think it's a regression introduced in v25. see example here: https://github.com/kittaakos/test-electron-builder I think electron-builder does not currently work correctly (and has never worked) with mono repostories with hoisted dependencies: It does not respect semver for subdependencies. It looks like some of this code has to be rewritted to properly resolve such dependencies: NodeModuleCopyHelper.ts or appFileCopier. I'm not sure what's the best workaround, but probably what works is to completely ditch asar (except for packages where it's absolutely needed) and instead use a different bundler like esbuild, |
@mifi I have tested electron-builder v25.1.8 and it has resolved the issue in #4516 (electron v21). Could you please test if v25.1.8 has resolved your issue as well? |
@beyondkmp Sorry for the late response. Thanks for fixing this issue! |
@beyondkmp 25.1.8 fixes the issue, thanks alot! |
25.0.5
22.8.0
10.8.0
32.1.0
current
macOS arm64
There's an issue with the latest
electron-builder
where after packaging an app, thenode_modules
directory will include wrong module versions for sub-modules.I'll explain better with a reproducible example:
cd electron-builder-issue
package.json
and remove thepostinstall
script to skip the model downloadnpm install
npm run build
release/mac-arm64
directory) and see that it workspackage.json
. UnderdevDependencies
, change theelectron-builder
version to25.0.5
npm install
npm run build
Sometimes it's about
require() of ES Module
, sometimes it's about a missing import, it's pretty random from my testings.Locate from the long error which module is "the importer" (the one trying to import another module), and which module is "the imported" (the module that was attempted to be imported).
This is the error I received when trying to open the app:
In my error:
"The importer" is:
string-width/node_modules/strip-ansi
"The imported" is:
ansi-regex
The above error happened because some of the code was trying to load some version of a module but instead received a completely different version of it.
Here's how you can validate that this is indeed the issue:
cd release/mac-arm64/node-llama-cpp-electron-example.app/Contents/Resources/
npx asar e app.asar app.content
cat ./app.content/node_modules/ansi-regex/package.json
and see that the version of the bundledansi-regex
is6.1.0
cat ./app.content/node_modules/string-width/node_modules/strip-ansi/package.json
and see this in thepackage.json
ofstrip-ansi
:As you can see,
strip-ansi
expected a^5.0.1
version ofansi-regex
, but actually received6.1.0
, which is incompatible.From my testings, this issue doesn't happen with
electron-builder
version25.0.0
, but does happen with25.0.1
.Because of this issue, I downgraded the version of
electron-builder
in thenode-llama-cpp
Electron template for now until this is resolved.The text was updated successfully, but these errors were encountered: