electron: Electron 35 "Cannot find package" regression

Preflight Checklist

Electron Version

35.0.0

What operating system(s) are you using?

Other Linux

Operating System Version

Linux debian 5.10.0-18-arm64 #1 SMP Debian 5.10.140-1 (2022-09-02) aarch64 GNU/Linux

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

34.3.0

Expected Behavior

Launching the app works.

Image

Actual Behavior

Launching the app fails with uncaught exception “Cannot find package”

Image

Testcase Gist URL

No response

Additional Information

The auto-launch dependency is a fairly common one in the Electron space, and the file the error talks about auto-launch/dist/index.js is present in the ASAR.

Image

As the earlier screenshots show, the same app.asar works with v34, but not with v35.

Based on automated tests in https://github.com/element-hq/element-desktop/pull/2195 it affects Windows, Mac & Linux across both amd64 & aarch64.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 6
  • Comments: 15 (3 by maintainers)

Most upvoted comments

There’s a hypothesis that this might be related to https://github.com/electron/electron/pull/45878.

Does this only break for the auto-launch package or also for other npm packages?

FWIW, we are facing the same issue with an Electron app that uses electron-updater when we try to use electron 35:

Uncaught Exception:
Error: Cannot find package '/.../electron_app/dist/mac/stage.app/Contents/Resources/app.asar/node_modules/electron-updater/out/main.js' imported from /.../electron_app/dist/mac/stage.app/Contents/Resources/app.asar/main.js
Did you mean to import "electron-updater/out/main.js"?
at legacyMainResolve (node:internal/modules/esm/resolve:208:44)
at packageResolve (node:internal/modules/esm/resolve:788:12)
at moduleResolve (node:internal/modules/esm/resolve:864:18)
at defaultResolve (node:internal/modules/esm/resolve:994:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:685:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:634:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:617:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:273:38)

I can confirm this bug! Here it happens with the following ESM packages:

electron-debug electron-context-menu electron-is-dev (uncertain with the last one but the first two are 100% broken)

All worked just fine with electron 34 to which we have to revert to, as this bug completely crashed our app and took some time to lead the root cause to the ESM flavor of the packages here.

I hope this can be fixed soon 😃 Thanks for your ongoing effort and support 😃

Unclear. That’s the one that trips when testing Element Desktop against v35. Its possible removing it would just explode elsewhere but I haven’t had the opportunity to test, I focused my time on the repro instead.