javascript - Exported Electron APP doesn't work on MacOS - Stack Overflow

I created my first Electron Application and I'm ready to publish it. I was able to export it for t

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:

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:            .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 +.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

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./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:            .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 +.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
Share edited Apr 11, 2018 at 21:06 blex 25.7k5 gold badges48 silver badges77 bronze badges asked Apr 11, 2018 at 20:51 CodyCody 9291 gold badge11 silver badges19 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 3

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.

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

Had this problem using pnpm. So I did rm -rf node_modules, then used bun bun i

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742292420a4416447.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信