我正在尝试使用构建电子应用程序的 snap 包https://github.com/electron-userland/electron-installer-snap
,但导致以下错误:
Priming desktop-gtk3
Files from the build host were migrated into the snap to satisfy dependencies that would otherwise not be met. This feature will be removed in a future release. If these libraries are needed in the final snap, ensure that the following are either satisfied by a stage-packages entry or through a part:
usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
The linker version '2.23' used by the base 'core' is incompatible with files in this snap:
/tmp/electron-snap-9865iSlcEOI8HnOY/prime/lib/x86_64-linux-gnu/libbsd.so.0.8.7 (2.25)
/tmp/electron-snap-9865iSlcEOI8HnOY/prime/lib/x86_64-linux-gnu/libexpat.so.1.6.7 (2.25)
/tmp/electron-snap-9865iSlcEOI8HnOY/prime/usr/lib/x86_64-linux-gnu/libexpatw.so.1.6.7 (2.25)
/tmp/electron-snap-9865iSlcEOI8HnOY/prime/usr/lib/x86_64-linux-gnu/libgnutls.so.30.14.10 (2.25)
/tmp/electron-snap-9865iSlcEOI8HnOY/prime/usr/lib/x86_64-linux-gnu/libp11-kit.so.0.3.0 (2.26)
/tmp/electron-snap-9865iSlcEOI8HnOY/prime/usr/lib/x86_64-linux-gnu/libxshmfence.so.1.0.0 (2.27)
Snapcraft failed (2)
(node:9865) UnhandledPromiseRejectionWarning: Error: Exited with status 2
at closeArgsToError (/usr/local/lib/node_modules/electron-installer-snap/node_modules/cross-spawn-promise/lib/index.js:20:16)
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/electron-installer-snap/node_modules/cross-spawn-promise/lib/index.js:76:19)
at Object.onceWrapper (events.js:317:30)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
(node:9865) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:9865) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
为什么会出现此错误?如何修复?
[已编辑]:这似乎是由不兼容的 nodejs 库问题引起的。已验证electron-installer-snap
在docker容器ubuntu 16.04中运行。
答案1
你可以通过在 lxd 容器内运行 snapcraft 来解决这个问题
安装 Snapcraft:
sudo snap install snapcraft
安装 lxd
sudo addgroup --system lxd
sudo adduser $USER lxd
sudo snap install lxd
在 lxd-container 内构建
lxd init
export SNAPCRAFT_BUILD_ENVIRONMENT=lxd
snapcraft cleanbuild