[solved] Electron-builder fails because of 'gtk-update-icon-cache-3.0: not found'


#1

I’m using electron builder with a basic package.json file.
When executing ‘yarn dist’ I get the following error:

/bin/sh: 39: gtk-update-icon-cache-3.0: not found
Failed to run ‘override-build’: Exit code was 127.

Unfortunately I have not found a solution to this online.

Here the log:

Building desktop-gtk2 
+ snapcraftctl build
make FLAVOR=gtk2 -j4
gcc -Wall -O2 -o bindtextdomain.so -fPIC -shared ./../src/bindtextdomain.c -ldl
make FLAVOR=gtk2 install DESTDIR=/home/gal/src/bottle/dist/__snap-x64/parts/desktop-gtk2/install
install -D -m755 desktop-launch "/home/gal/src/bottle/dist/__snap-x64/parts/desktop-gtk2/install"/bin/desktop-launch
install -D -m644 flavor-select "/home/gal/src/bottle/dist/__snap-x64/parts/desktop-gtk2/install"/
install -D -m644 bindtextdomain.so "/home/gal/src/bottle/dist/__snap-x64/parts/desktop-gtk2/install"/lib/bindtextdomain.so
+ export XDG_DATA_DIRS=/home/gal/src/bottle/dist/__snap-x64/parts/desktop-gtk2/install/usr/share
+ update-mime-database /home/gal/src/bottle/dist/__snap-x64/parts/desktop-gtk2/install/usr/share/mime
+ [ -f /home/gal/src/bottle/dist/__snap-x64/parts/desktop-gtk2/install/usr/share/icons/Adwaita//index.theme ]
+ 
+ + gtk-update-icon-cache-3.0 -q /home/gal/src/bottle/dist/__snap-x64/parts/desktop-gtk2/install/usr/share/icons/Adwaita/
which gtk-update-icon-cache-3.0
/bin/sh: 39: gtk-update-icon-cache-3.0: not found
Failed to run 'override-build': Exit code was 127.
  ⨯ exit status 2
github.com/develar/app-builder/pkg/util.ExecuteWithInheritedStdOutAndStdErr
	/Volumes/data/Documents/app-builder/pkg/util/util.go:59
github.com/develar/app-builder/pkg/package-format/snap.buildWithoutDockerAndWithoutTemplate
	/Volumes/data/Documents/app-builder/pkg/package-format/snap/snap.go:320
github.com/develar/app-builder/pkg/package-format/snap.Snap
	/Volumes/data/Documents/app-builder/pkg/package-format/snap/snap.go:232
github.com/develar/app-builder/pkg/package-format/snap.ConfigureCommand.func1
	/Volumes/data/Documents/app-builder/pkg/package-format/snap/snap.go:103
github.com/alecthomas/kingpin.(*actionMixin).applyActions
	/Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/actions.go:28
github.com/alecthomas/kingpin.(*Application).applyActions
	/Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:557
github.com/alecthomas/kingpin.(*Application).execute
	/Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:390
github.com/alecthomas/kingpin.(*Application).Parse
	/Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:222
main.main
	/Volumes/data/Documents/app-builder/main.go:80
runtime.main
	/usr/local/Cellar/go/1.12.1/libexec/src/runtime/proc.go:200
runtime.goexit
	/usr/local/Cellar/go/1.12.1/libexec/src/runtime/asm_amd64.s:1337

Error: /home/gal/src/bottle/node_modules/app-builder-bin/linux/x64/app-builder exited with code 1
    at ChildProcess.childProcess.once.code (/home/gal/src/bottle/node_modules/builder-util/src/util.ts:244:14)
    at Object.onceWrapper (events.js:281:20)
    at ChildProcess.emit (events.js:193:13)
    at maybeClose (internal/child_process.js:999:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
From previous event:
    at SnapTarget.build (/home/gal/src/bottle/node_modules/app-builder-lib/src/targets/snap.ts:148:44)
    at Function.buildAsyncTargets (/home/gal/src/bottle/node_modules/app-builder-lib/src/platformPackager.ts:140:36)
    at LinuxPackager.packageInDistributableFormat (/home/gal/src/bottle/node_modules/app-builder-lib/src/platformPackager.ts:119:24)
    at /home/gal/src/bottle/node_modules/app-builder-lib/src/platformPackager.ts:114:10
    at Generator.next (<anonymous>)
    at processImmediate (internal/timers.js:443:21)
From previous event:
    at LinuxPackager.pack (/home/gal/src/bottle/node_modules/app-builder-lib/src/platformPackager.ts:111:95)
    at /home/gal/src/bottle/node_modules/app-builder-lib/src/packager.ts:430:24
    at Generator.next (<anonymous>)
    at xfs.stat (/home/gal/src/bottle/node_modules/fs-extra/lib/mkdirs/mkdirs.js:56:16)
    at /home/gal/src/bottle/node_modules/graceful-fs/polyfills.js:285:20
    at FSReqCallback.oncomplete (fs.js:159:5)
From previous event:
    at Packager.doBuild (/home/gal/src/bottle/node_modules/app-builder-lib/src/packager.ts:396:24)
    at /home/gal/src/bottle/node_modules/app-builder-lib/src/packager.ts:366:57
    at Generator.next (<anonymous>)
    at /home/gal/src/bottle/node_modules/graceful-fs/graceful-fs.js:111:16
    at /home/gal/src/bottle/node_modules/graceful-fs/graceful-fs.js:45:10
    at FSReqCallback.args [as oncomplete] (fs.js:145:20)
From previous event:
    at Packager._build (/home/gal/src/bottle/node_modules/app-builder-lib/src/packager.ts:335:133)
    at /home/gal/src/bottle/node_modules/app-builder-lib/src/packager.ts:331:23
    at Generator.next (<anonymous>)
    at processImmediate (internal/timers.js:443:21)
From previous event:
    at Packager.build (/home/gal/src/bottle/node_modules/app-builder-lib/src/packager.ts:288:14)
    at build (/home/gal/src/bottle/node_modules/app-builder-lib/src/index.ts:59:28)
    at build (/home/gal/src/bottle/node_modules/electron-builder/src/builder.ts:228:10)
    at then (/home/gal/src/bottle/node_modules/electron-builder/src/cli/cli.ts:46:19)
error Command failed with exit code 1.

#2

I have copied the snapcraft.yaml file that was created by electron-builder and edited it such that it now uses gtk-update-icon-cache.

I’m now using the regular snapcraft.yaml file.
So my issue is kind of solved.


#3

I had to change the electron version in the packages.json file to “^2.0.0”.
This solved the issue.