Electron-Builder: Icon on Linux doesn't work
See original GitHub issueOn MacOS High Sierra 10.13.6:
- Electron: 2.0.4
- Electron Builder: 20.20.4
On Linux Ubuntu 18.04:
- Electron: 2.0.5
- Electron Builder: 20.22.0 also tried Electron: 2.0.4 & electron builder 20.20.4.
- Target: Ubuntu 18.04 ( amd64.deb) or Fedora 28 (x86_64.rpm)
Hi,
When building a deb package on MacOs High Sierra with an icon set to the following configuration, it works. The icon is displayed in the task bar in Ubuntu 18.04.
"linux": { "icon": "build/128x128.icns", ...
When building on Ubuntu 18.04 (on which icnsutils is installed) with the same configuration, I get the error:
build --linux deb
• electron-builder version=20.22.0 • loaded configuration file=package.json (“build” field) • writing effective config file=/home/local/workspace/build/dist/builder-effective-config.yaml • no native production dependencies • packaging platform=linux arch=x64 electron=2.0.5 appOutDir=/home/local/workspace/build/dist/linux-unpacked • building target=deb arch=x64 file=/home/local/workspace/build/dist/MyApp_0.6.1_amd64.deb panic: runtime error: index out of range
goroutine 1 [running]: github.com/develar/app-builder/pkg/icons.ConvertIcnsToPng(0xc4200262d0, 0x43, 0x7fffe9f5590c, 0x2a, 0xc42017fb98, 0x2, 0xaaba6a, 0x4, 0xc4200262d0) /Users/develar/go/src/github.com/develar/app-builder/pkg/icons/icns-to-png.go:60 +0x4a3 github.com/develar/app-builder/pkg/icons.ConvertIcon(0xc4200650c0, 0x4, 0x4, 0xc420236620, 0x2, 0x2, 0x7fffe9f5588c, 0x3, 0x7fffe9f5590c, 0x2a, …) /Users/develar/go/src/github.com/develar/app-builder/pkg/icons/icon-converter.go:158 +0x76e github.com/develar/app-builder/pkg/icons.ConfigureCommand.func1(0xc4201f1c20, 0x40e5b3, 0xa01700) /Users/develar/go/src/github.com/develar/app-builder/pkg/icons/icon-converter.go:27 +0x99 github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin.(*actionMixin).applyActions(0xc4200c09d8, 0xc4201f1c20, 0x0, 0x0) /Users/develar/go/src/github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin/actions.go:28 +0x6d github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin.(*Application).applyActions(0xc4200c2690, 0xc4201f1c20, 0x0, 0x0) /Users/develar/go/src/github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin/app.go:557 +0xde github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin.(*Application).execute(0xc4200c2690, 0xc4201f1c20, 0xc420230580, 0x1, 0x1, 0x0, 0x0, 0x773cd2, 0x9eab80) /Users/develar/go/src/github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin/app.go:390 +0x8f github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin.(*Application).Parse(0xc4200c2690, 0xc42001c130, 0x11, 0x11, 0xc42002c358, 0x0, 0x2, 0x2) /Users/develar/go/src/github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin/app.go:222 +0x1f2 main.main() /Users/develar/go/src/github.com/develar/app-builder/main.go:64 +0x17d Error: /home/local/workspace/build/MyApp/node_modules/app-builder-bin/linux/x64/app-builder exited with code 2 at ChildProcess.childProcess.once.code (/home/local/workspace/build/MyApp/node_modules/builder-util/src/util.ts:251:14) at Object.onceWrapper (events.js:317:30) at emitTwo (events.js:126:13) at ChildProcess.emit (events.js:214:7) at maybeClose (internal/child_process.js:925:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5) From previous event: at LinuxPackager.resolveIcon (/home/local/workspace/build/MyApp/node_modules/electron-builder-lib/src/platformPackager.ts:565:69) at /home/local/workspace/build/MyApp/node_modules/electron-builder-lib/src/targets/LinuxTargetHelper.ts:43:35 at Generator.next (<anonymous>) From previous event: at LinuxTargetHelper.computeDesktopIcons (/home/local/workspace/build/MyApp/node_modules/electron-builder-lib/src/targets/LinuxTargetHelper.ts:25:36) at Lazy.LinuxTargetHelper.iconPromise (/home/local/workspace/build/MyApp/node_modules/electron-builder-lib/src/targets/LinuxTargetHelper.ts:13:54) at Lazy.get value [as value] (/home/local/workspace/build/MyApp/node_modules/lazy-val/src/main.ts:18:23) at LinuxTargetHelper.get icons [as icons] (/home/local/workspace/build/MyApp/node_modules/electron-builder-lib/src/targets/LinuxTargetHelper.ts:21:29) at /home/local/workspace/build/MyApp/node_modules/electron-builder-lib/src/targets/fpm.ts:201:22 From previous event: at FpmTarget.build (/home/local/workspace/build/MyApp/node_modules/electron-builder-lib/src/targets/fpm.ts:232:43) at /home/local/workspace/build/MyApp/node_modules/electron-builder-lib/src/platformPackager.ts:130:24 From previous event: at AsyncTaskManager.add (/home/local/workspace/build/MyApp/node_modules/builder-util/src/asyncTaskManager.ts:14:20) at LinuxPackager.packageInDistributableFormat (/home/local/workspace/build/MyApp/node_modules/electron-builder-lib/src/platformPackager.ts:122:17) at /home/local/workspace/build/MyApp/node_modules/electron-builder-lib/src/platformPackager.ts:113:10 at Generator.next (<anonymous>) at runCallback (timers.js:794:20) at tryOnImmediate (timers.js:752:5) at processImmediate [as _immediateCallback] (timers.js:729:5) From previous event: at LinuxPackager.pack (/home/local/workspace/build/MyApp/node_modules/electron-builder-lib/src/platformPackager.ts:110:95) at /home/local/workspace/build/MyApp/node_modules/electron-builder-lib/src/packager.ts:376:24 at Generator.next (<anonymous>) at xfs.stat (/home/local/workspace/build/MyApp/node_modules/fs-extra/lib/mkdirs/mkdirs.js:56:16) at /home/local/workspace/build/MyApp/node_modules/graceful-fs/polyfills.js:287:18 at FSReqWrap.oncomplete (fs.js:153:5) From previous event: at Packager.doBuild (/home/local/workspace/build/MyApp/node_modules/electron-builder-lib/src/packager.ts:344:39) at /home/local/workspace/build/MyApp/node_modules/electron-builder-lib/src/packager.ts:314:57 at Generator.next (<anonymous>) at /home/local/workspace/build/MyApp/node_modules/graceful-fs/graceful-fs.js:99:16 at /home/local/workspace/build/MyApp/node_modules/graceful-fs/graceful-fs.js:43:10 at FSReqWrap.oncomplete (fs.js:135:15) From previous event: at Packager._build (/home/local/workspace/build/MyApp/node_modules/electron-builder-lib/src/packager.ts:285:133) at /home/local/workspace/build/MyApp/node_modules/electron-builder-lib/src/packager.ts:281:23 at Generator.next (<anonymous>) at runCallback (timers.js:794:20) at tryOnImmediate (timers.js:752:5) at processImmediate [as _immediateCallback] (timers.js:729:5) From previous event: at Packager.build (/home/local/workspace/build/MyApp/node_modules/electron-builder-lib/src/packager.ts:238:14) at build (/home/local/workspace/build/MyApp/node_modules/electron-builder-lib/src/index.ts:46:28) at build (/home/local/workspace/build/MyApp/node_modules/electron-builder/src/builder.ts:224:10) at then (/home/local/workspace/build/MyApp/node_modules/electron-builder/src/cli/cli.ts:42:48) at <anonymous>
npm ERR! Linux 4.15.0-20-generic npm ERR! argv “/usr/bin/node” “/usr/bin/npm” “run” “deb” npm ERR! node v8.10.0 npm ERR! npm v3.5.2 npm ERR! code ELIFECYCLE npm ERR! MyApp@0.6.1 deb:
build --linux deb
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the MyApp@0.6.1 deb script ‘build --linux deb’. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the MyApp package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! build --linux deb npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs MyApp npm ERR! Or if that isn’t available, you can get their info via: npm ERR! npm owner ls MyApp npm ERR! There is likely additional logging output above.npm ERR! Please include the following file with any support request: npm ERR! /home/local/workspace/build/MyApp/npm-debug.log Error
So I tried with differents png. On Linux I can build a deb or rpm package with an icon set to 256x256.png or 512x512.png (or icon-256x256.png) but the icon doesn’t show u in the task bar in Ubuntu and Fedora.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
Could you include your
package.json
?Here is the fix https://github.com/electron-userland/electron-builder/issues/2577#issuecomment-711122281