question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build arch: universal fail macOS 12.3 TypeError: Cannot read properties of undefined (reading 'Resources')

See original GitHub issue
  • Electron-Builder Version: 23.0.3
  • Node Version: ~16.13.2~ [updated to 16.14.3]
  • Electron Version: 17.1.2
  • Electron Type (current, beta, nightly): current
  • Electron Updater: 5.0.0
  • Target: mac: { target: { target: 'default', arch: 'universal' } }

  • Dev Machine: Mac mini (M1, 2020)

  • Dev OS version: macOS Monterey 12.3

After experiencing the issue raised #6606 here, I now get the following errors trying to build.

App · Bundling app with electron-builder...

  • electron-builder  version=23.0.3 os=21.4.0
  • writing effective config  file=dist/electron/Packaged/builder-effective-config.yaml
  • packaging       platform=darwin arch=x64 electron=17.1.2 appOutDir=dist/electron/Packaged/mac-universal--x64
  • packaging       platform=darwin arch=arm64 electron=17.1.2 appOutDir=dist/electron/Packaged/mac-universal--arm64
  • packaging       platform=darwin arch=universal electron=17.1.2 appOutDir=dist/electron/Packaged/mac-universal

 App · ⚠️  [FAIL] electron-builder could not build

TypeError: Cannot read properties of undefined (reading 'Resources')

UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "undefined".

I can’t seem to get any further diagnosis.

EDIT:

Tried to build changing arch to arm64 - build was successful. Now to figure out how to build a universal dmg bundle. 🤔 Was even able to build win-ia32, arm64-win, and AppImage without issues.

...
mac: {
  target: {
     target: 'default',
     // arch: 'universal'
     arch: 'arm64'
  },
…

Build with x64 also successful.

...
mac: {
  target: {
     target: 'default',
     // arch: 'universal'
     arch: 'x64'
  },
…

cannot build universal dmg.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
mmaiettacommented, Mar 23, 2022

If this becomes a more prevalent issue, then I’ll consider making it false by default. Since this is the first report of this issue, I have a feeling that it’s unique to your dev env.

mergeASARS is a new param in @electron/universal, and the prop is not mandatory if using universal builds.

1reaction
andirsuncommented, Jun 17, 2022

Same error here

 • electron-builder  version=23.1.0 os=21.5.0
  • loaded configuration  file=/Users/julianacaromoreno/projects/streamline-web/electron-builder.yml
  • writing effective config  file=dist/builder-effective-config.yaml
  • packaging       platform=darwin arch=x64 electron=19.0.4 appOutDir=dist/mac-universal--x64
  • SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at /Users/julianacaromoreno/projects/streamline-web/node_modules/app-builder-lib/src/fileTransformer.ts:41:35
  • packaging       platform=darwin arch=arm64 electron=19.0.4 appOutDir=dist/mac-universal--arm64
  • SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at /Users/julianacaromoreno/projects/streamline-web/node_modules/app-builder-lib/src/fileTransformer.ts:41:35
  • packaging       platform=darwin arch=universal electron=19.0.4 appOutDir=dist/mac-universal
  ⨯ Cannot read properties of undefined (reading 'Resources')  failedTask=build stackTrace=TypeError: Cannot read properties of undefined (reading 'Resources')
    at Filesystem.getNode (/Users/julianacaromoreno/projects/streamline-web/node_modules/asar/lib/filesystem.js:132:24)
    at Filesystem.getFile (/Users/julianacaromoreno/projects/streamline-web/node_modules/asar/lib/filesystem.js:140:23)
    at Filesystem.getFile (/Users/julianacaromoreno/projects/streamline-web/node_modules/asar/lib/filesystem.js:144:19)
    at Object.module.exports.statFile (/Users/julianacaromoreno/projects/streamline-web/node_modules/asar/lib/asar.js:157:21)
    at buildUnpacked (/Users/julianacaromoreno/projects/streamline-web/node_modules/@electron/universal/src/asar-utils.ts:95:25)
    at Object.exports.mergeASARs (/Users/julianacaromoreno/projects/streamline-web/node_modules/@electron/universal/src/asar-utils.ts:108:3)
    at exports.makeUniversalApp (/Users/julianacaromoreno/projects/streamline-web/node_modules/@electron/universal/src/index.ts:205:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at MacPackager.doPack (/Users/julianacaromoreno/projects/streamline-web/node_modules/app-builder-lib/src/macPackager.ts:125:9)
    at MacPackager.pack (/Users/julianacaromoreno/projects/streamline-web/node_modules/app-builder-lib/src/macPackager.ts:191:7)
    at Packager.doBuild (/Users/julianacaromoreno/projects/streamline-web/node_modules/app-builder-lib/src/packager.ts:441:9)
    at Object.executeFinally (/Users/julianacaromoreno/projects/streamline-web/node_modules/builder-util/src/promise.ts:12:14)
    at Packager._build (/Users/julianacaromoreno/projects/streamline-web/node_modules/app-builder-lib/src/packager.ts:376:31)
    at Packager.build (/Users/julianacaromoreno/projects/streamline-web/node_modules/app-builder-lib/src/packager.ts:337:12)
    at Object.executeFinally (/Users/julianacaromoreno/projects/streamline-web/node_modules/builder-util/src/promise.ts:12:14)


Cannot build electron packages:
Error: Command failed with exit code 1: electron-builder
Read more comments on GitHub >

github_iconTop Results From Across the Web

Ionic fails building in macos 12 (Monterey) - cordova
In my case changing just one file wasn't enough. After changing /usr/local/lib/node_modules/cordova/node_modules/macos-release/index. js I got ...
Read more >
Clang linking error MacOS Big Sur | Apple Developer Forums
Hi All, I am trying to build my helloworld.cpp, but I am having problem since I updated to Big Sur. Below a verbose...
Read more >
Bug listing with status RESOLVED with resolution OBSOLETE ...
... Bug:131367 - "GNAP fails to build extensions if no useflags declared" ... and can't be read" status:RESOLVED resolution:OBSOLETE severity:normal ...
Read more >
macOS Monterey Problems - MacPorts Trac
If you have a universal MacPorts installation on an Apple Silicon Mac, and you run it from a terminal emulator that is not...
Read more >
How to use Universal Control on Mac and iPad | Apple Support
Starting in macOS 12.3 and iPadOS 15.4, you can use Universal Control to work seamlessly between your Mac and your iPad using just...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found