electron-builder: "Error: Cannot find module 'jsonfile/utils'" in linux appimage build

  • Electron-Builder Version:

“electron-builder@25.0.5”

  • Node Version: 20.17.0/x64 on github actions
  • Electron Version:
  • Electron Type (current, beta, nightly): current (electron@32.1.0)
  • Target: AppImage

Latest build of AppImage fails to start with error message:

 ./jbrowse-desktop-v2.15.3-linux.AppImage
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Cannot find module 'jsonfile/utils'
Require stack:
- /tmp/.mount_jbrowsjehAMT/resources/app.asar/node_modules/electron-updater/node_modules/fs-extra/lib/json/output-json.js
- /tmp/.mount_jbrowsjehAMT/resources/app.asar/node_modules/electron-updater/node_modules/fs-extra/lib/json/index.js
- /tmp/.mount_jbrowsjehAMT/resources/app.asar/node_modules/electron-updater/node_modules/fs-extra/lib/index.js
- /tmp/.mount_jbrowsjehAMT/resources/app.asar/node_modules/electron-updater/out/main.js
- /tmp/.mount_jbrowsjehAMT/resources/app.asar/build/electron.js
-
    at Module._resolveFilename (node:internal/modules/cjs/loader:1232:15)
    at s._resolveFilename (node:electron/js2c/browser_init:2:124039)
    at Module._load (node:internal/modules/cjs/loader:1058:27)
    at c._load (node:electron/js2c/node_init:2:17025)
    at Module.require (node:internal/modules/cjs/loader:1318:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/tmp/.mount_jbrowsjehAMT/resources/app.asar/node_modules/electron-updater/node_modules/fs-extra/lib/json/output-json.js:3:23)
    at Module._compile (node:internal/modules/cjs/loader:1484:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1564:10)
    at Module.load (node:internal/modules/cjs/loader:1295:32)

if i unzip the app.asar file, i can see that there is a app.asar/node_modules/jsonfile but that is v4, while the fs-extra there wants v6

here are some screenshots, see filename paths pointing the the node_modules directory that i unzipped from the app.asar file with “npx @electron/asar extract app.asar outdir”

image

image

I normally use “yarn” (v1) to install my node_modules in my normal monorepo, but am unsure how the node_modules directory is constructed for this project. I haven’t yet traced the exact root cause, but seems something with the node_modules directory format/construction in the app.asar

i update versions of stuff a lot so dont know exactly the cause. this is the entire diff of the yarn.lock between a version that works (did not give the above error) and a version that gave the error. i didn’t see anything that really stood out (no fs-extra changes, no jsonfile changes, no electron-builder changes, no electron-updater changes

if i had one question, it would probably be how the node_modules in the app.asar is created?

this is the full diff between a working version of our app and the failing https://github.com/GMOD/jbrowse-components/compare/v2.15.1..v2.15.3/ (v2.15.2 was skipped)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17

Commits related to this issue

Most upvoted comments

noice! thank you for the fast response.