Hi,
Two days ago my snapcraft snap was updated from 3.8 to 3.9.5/3.9.7 version, and now my electron kiosk builds fail. I was able to revert it on my local computer to version 3.8, but on my pipeline I was playing with some edge channels during last two days and unfortunately I don’t have previous version of this snapcraft snap on it, and … it is no available to download.
After reverting to 3.8 application builds, but with 3.9.5/3.9.7 I get this error:
Skipping pull xwayland-kiosk-helper (already ran)
Skipping pull terminal (already ran)
Skipping build desktop-gtk3 (already ran)
Skipping build xwayland-kiosk-helper (already ran)
Building terminal
npm WARN deprecated cross-zip@2.1.6: Possible security issue issue found in 2.x. Please update to 3.x
loadDep:global-tunnel-ng
> core-js@3.6.4 postinstall /root/parts/terminal/build/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
terminal@1.0.0 /root/parts/terminal/build
└── electron-packager@14.2.0 extraneous
npm WARN terminal@1.0.0 No repository field.
Cannot find module 'electron' from '/root/parts/terminal/build'
Failed to run 'override-build': Exit code was 1.
It seems like dev dependencies are not installed, like they were before. My snapcraft.yaml looks like this (it is based on https://tutorials.ubuntu.com/tutorial/electron-kiosk#3):
parts:
terminal:
plugin: nodejs
nodejs-version: 12.13.0
source: ./
after: [desktop-gtk3, xwayland-kiosk-helper]
override-build: |
case $SNAPCRAFT_ARCH_TRIPLET in
"i386-linux-gnu") ARCH="ia32";;
"x86_64-linux-gnu") ARCH="x64";;
"arm-linux-gnueabihf") ARCH="armv7l";;
"aarch64-linux-gnu") ARCH="arm64";;
*) echo "ERROR: electron does not support the '$SNAPCRAFT_ARCH_TRIPLET' architecture" && exit 1;;
esac
npm install electron-packager &&
./node_modules/.bin/electron-packager . --overwrite --platform=linux --arch=$ARCH --output=release-build --prune=true
and my package.json is
{
"name": "terminal",
"version": "1.0.0",
"description": "Electron encapsulation",
"main": "./src/main/main.js",
"scripts": {
"test": "test",
"start": "electron .",
"stenv": "electron -r dotenv/config .",
"dist": "electron-builder --linux snap",
"postinstall": "electron-builder install-app-deps"
},
"author": "",
"license": "ISC",
"devDependencies": {
"electron": "^6.0.12",
"electron-builder": "^21.2.0"
},
"dependencies": {
"@sentry/electron": "^1.2.0",
"auto-launch": "^5.0.5",
"dotenv": "^8.2.0",
"firebase": "^6.6.1",
"node-rsa": "^1.0.7",
"qrcode": "^1.4.2",
"request": "^2.88.0",
"requests": "^0.3.0",
"rxfire": "^3.9.1",
"rxjs": "^6.5.3",
"serialport": "^7.1.5"
},
"build": {
"appId": "terminal",
"extraResources": [
{
"from": "./extraResources/",
"to": "extraResources",
"filter": [
"**/*"
]
}
]
}
}
If I add npm install to override build like this:
npm install &&
npm install electron-packager &&
./node_modules/.bin/electron-packager . --overwrite --platform=linux --arch=$ARCH --output=release-build --prune=true
Electron app downloads dependencies and it builds, but there are still some missing dependencies in snap and it fails to start:
glamor: EGL version 1.4:
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Failed to load gRPC binary module because it was not installed for the current system
Expected directory: electron-v6.1-linux-x64-glibc
Found: [node-v57-linux-x64-glibc]
This problem can often be fixed by running "npm rebuild" on the current system
Original error: Cannot find module '/snap/terminal-app/x1/terminal-linux-x64/resources/app/node_modules/grpc/src/node/extension_binary/electron-v6.1-linux-x64-glibc/grpc_node.node'
Require stack:
- /snap/terminal-app/x1/terminal-linux-x64/resources/app/node_modules/grpc/src/grpc_extension.js
- /snap/terminal-app/x1/terminal-linux-x64/resources/app/node_modules/grpc/src/client_interceptors.js
- /snap/terminal-app/x1/terminal-linux-x64/resources/app/node_modules/grpc/src/client.js
- /snap/terminal-app/x1/terminal-linux-x64/resources/app/node_modules/grpc/index.js
- /snap/terminal-app/x1/terminal-linux-x64/resources/app/node_modules/@firebase/firestore/dist/index.node.cjs.js
- /snap/terminal-app/x1/terminal-linux-x64/resources/app/node_modules/firebase/firestore/dist/index.cjs.js
- /snap/terminal-app/x1/terminal-linux-x64/resources/app/src/main/main.js
-
at Object.<anonymous> (/snap/terminal-app/x1/terminal-linux-x64/resources/app/node_modules/grpc/src/grpc_extension.js:53:17)
at Module._compile (internal/modules/cjs/loader.js:786:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:798:10)
at Module.load (internal/modules/cjs/loader.js:645:32)
at Function.Module._load (internal/modules/cjs/loader.js:560:12)
at Module.require (internal/modules/cjs/loader.js:685:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (/snap/terminal-app/x1/terminal-linux-x64/resources/app/node_modules/grpc/src/client_interceptors.js:144:12)
at Module._compile (internal/modules/cjs/loader.js:786:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:798:10)
Any ideas what might have changed ? Or I am just missing something obvious?