crc-org / tray-electron

Archive of the Desktop/tray application of CRC Runs Containers
https://crc.dev
Apache License 2.0
4 stars 5 forks source link

[bug] tray errors out due to uncaught exception after upgrading npm modules #228

Closed anjannath closed 1 year ago

anjannath commented 1 year ago

The tray after 5deabed1cf20581b8c37548146182372d4e15842 is throwing the following exception:

Uncaught Exception:
Error [ERR_REQUIRE_ESM]: require() of ES Module /private/tmp/trays/crc-tray-darwin-universal/crc-tray.app/Contents/Resources/app.asar/node_modules/got/dist/source/index.js from /private/tmp/trays/crc-tray-darwin-universal/crc-tray.app/Contents/Resources/app.asar/build/src/commander.js not supported.
Instead change the require of index.js in /private/tmp/trays/crc-tray-darwin-universal/crc-tray.app/Contents/Resources/app.asar/build/src/commander.js to a dynamic import() which is available in all CommonJS modules.
at c._load (node:electron/js2c/asar_bundle:5:13339)
at Object.<anonymous> (/private/tmp/trays/crc-tray-darwin-universal/crc-tray.app/Contents/Resources/app.asar/build/src/commander.js:4:13)
at c._load (node:electron/js2c/asar_bundle:5:13339)
at Object.<anonymous> (/private/tmp/trays/crc-tray-darwin-universal/crc-tray.app/Contents/Resources/app.asar/build/src/main.js:31:21)
at c._load (node:electron/js2c/asar_bundle:5:13339)
at Object.<anonymous> (node:electron/js2c/browser_init:189:3102)
at ./lib/browser/init.ts (node:electron/js2c/browser_init:189:3306)
at __webpack_require__ (node:electron/js2c/browser_init:1:128)
at node:electron/js2c/browser_init:1:1200
at node:electron/js2c/browser_init:1:1267
at c._load (node:electron/js2c/asar_bundle:5:13339)

As mentioned in the exception, changing the require to import doesn't solve this issue and still the exception occurs, build from this commit also errors out giving the above exception.

anjannath commented 1 year ago

looks similar to: https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/3112