简体   繁体   中英

Exported Electron APP doesn't work on MacOS

I created my first Electron Application and I'm ready to publish it. I was able to export it for these two platforms with no errors:

  • Linux Debian
  • Windows

But when I export it for MacOS, the test.app doesn't work.

I'm using MacOS HighSierra and I tested everything I could think of, but couldn't get my app to work on MacOS.

I'm not sure if I have to convert it to a dmg file before executing it, so I tested converting my app to .dmg using this guide:

https://kb.parallels.com/en/123895

But when I run the dmg and try to install the app, I get same errors again. I really tried everything but got no luck. I hope there is someone here that knows how to get it exported for MacOS.

To export the app I used the electron-packager and this is my package.json

   {
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "scripts": {
    "start": "electron .",
    "package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds --app-copyright=\"test",
    "package-win": "electron-packager . test --overwrite --asar=true --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"test\" --app-copyright=\"test\"",
    "package-linux": "electron-packager . test --overwrite --asar=true --platform=linux --arch=x64 --icon=assets/icons/png/icon.png --prune=true --out=release-builds --app-copyright=\"test"
  },
  "dependencies": {},
  "devDependencies": {
    "electron": "1.8.4",
    "electron-packager": "^9.0.1"
  }
}

And this is my Error Log when I try to run the test.app file on the Mac, that I had exported from Electron:

Process:               test [657]
Path:                  /Volumes/*/test.app/Contents/MacOS/test
Identifier:            com.electron.test
Version:               1.1.1 (1.1.1)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           test [657]
User ID:               501

Date/Time:             2018-04-11 13:23:39.858 -0700
OS Version:            Mac OS X 10.13 (17A291j)
Report Version:        12
Anonymous UUID:        0CF5BE48-84D7-4216-9DC6-58685E649DDD


Time Awake Since Boot: 550 seconds

System Integrity Protection: enabled

Crashed Thread:        0

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    DYLD, [0x1] Library missing

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
  Library not loaded: @rpath/Electron Framework.framework/Electron Framework
  Referenced from: /Volumes/*/test.app/Contents/MacOS/test
  Reason: no suitable image found.  Did find:
    /Volumes/VMware Shared Folders/dev/test.app/Contents/MacOS/../Frameworks/Electron Framework.framework/  Electron Framework: file too short
    /Volumes/VMware Shared Folders/dev/app/release/test-darwin-x64/test.app/Contents/MacOS/../Frameworks/   Electron Framework.framework/Electron Framework: stat() failed with errno=1

Binary Images:
       0x103f99000 -        0x103f99ff7 +com.electron.test (1.1.1 - 1.1.1) <    C11B8E11-EDD2-37B9-9AB5-5FE9E97FFFFB> /Volumes/*/test.app/Contents/MacOS/test
       0x10d97a000 -        0x10d9c237f  dyld (513.2) <CEB3F2DA-93CF-3991-AD98-582FAF7023AB> /usr/lib/dyld

If the source code is running properly with npm start on mac machine then it is an electron-packager issue. I would suggest you to try to make a build using electron-builder .

Note: You will need a mac machine to make a .dmg build.

See the configuration of zulip/zulip-electron

I was facing the crash issue repeatedly when launching an app on Mac .

The reason for the crash turned out to be permissions issue on some of the Electron framework folders. The folders had 744 permission and root as owner, because of which the logged in user was not able to execute the framework files . Changing the permission to 755 for the folder fixed the issue for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM