为什么在Ubuntu上运行snapcraft时,在electron forge内部会出现这种未经处理的拒绝?

vatpfxk5  于 2023-09-28  发布在  Electron
关注(0)|答案(1)|浏览(180)

注意:此文件不是An unhandled rejection has occurred inside Forge: Error: Could not find any Electron packages in devDependencies的重复文件

这个问题的答案是将authordescription标记添加到package.json,我已经添加了这些标记。
下面是详细信息

尝试使用Electron Forge构建Snap包

1.我已经在我的项目中设置了forge.config.js,我可以构建所有其他版本包:deb,rpm,windows,mac(zip & dmg)
1.我现在尝试让electron forge使用@electron-forge/maker-snap(npm package here)构建snap包。这是一个正式引用的电子锻造文档在这里。
1.我运行$ npm run make来触发该命令--这是电子项目执行此操作的官方方法。
1.我创建了一个全新的目标目录,将我的代码克隆到其中,并从那里尝试过,但它仍然以同样的方式失败。
下面是它运行和失败时的样子:

下面是失败信息的文本:

An unhandled rejection has occurred inside Forge:
Error: Command failed with a non-zero return code (2):
/usr/bin/snapcraft snap --output=/home/raddev/dev/electron/CYaPass-Electron/out/make/snap/x64/cyapass_1.4.4_amd64.snap
at ChildProcess.<anonymous> (/home/raddev/dev/electron/CYaPass-Electron/node_modules/@malept/cross-spawn-promise/dist/src/index.js:99:24)
    at ChildProcess.emit (node:events:514:28)
    at ChildProcess.emit (node:domain:489:12)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)

成功构建应用

它还成功地将其打包为deb,但随后未能将其打包为快照。

我所尝试的

  1. rm -rf out删除out文件夹(project下的目标构建目录)(这样npm进程将创建direct并再次拥有所有者访问权限-以防由于某种原因失败。
    1.此安装程序的forge.config.js文件中的所有配置值。
    1.尝试手动运行snapcraft命令行,但我没有打包器创建的yaml。

什么是真正的失败

正在发生的真实的故障是在调用我机器上的snapcraft应用程序时。我检查了版本是snapcraft 7.5.2
下面是它失败的命令:
/usr/bin/snapcraft snap --output=/home/raddev/dev/electron/CYaPass-Electron/out/make/snap/x64/cyapass_1.4.4_amd64.snap
我甚至检查了npm库(node_modules/@malept/cross-spawn-promise/dist/src/index.js:99:24)中的目标代码,但这只是抛出异常的地方

掉进兔子洞

经过大量的研究和失败的尝试,我找到了一个命令,它允许我指向我基于linux的electron应用程序构建并运行npx来启动snapcraft。找到command here了。
npx electron-installer-snap --src=out/myappname-linux-x64
当我运行时,我得到了一个类似的错误,我以前收到,但最终得到了一些额外的信息。
npx electron-installer-snap --src=.启动Snapcraft 7.5.2
将执行记录到“/home/raddev/.local/state/snapcraft/log/snapcraft-20230905-112449.770165.log”

您需要“multipass”设置来构建快照:https://multipass.run.

我不知道multipass是什么,所以我搜索了web和found it here。然后我运行install命令:sudo snap install multipass
之后,我再次尝试该命令,但仍然出现错误:
npx electron-installer-snap --src=.
启动Snapcraft 7.5.2
将执行记录到“/home/raddev/.local/state/snapcraft/log/snapcraft-20230905-113958.477233.log”生成环境处于未知状态,请先进行清理。信息失败:无法连接到多通道套接字启动失败:无法连接到多通道套接字尝试使用“multipass”启动时示例出错:返回退出代码2。请确保“multipass”设置正确,然后重试。

重启后的不同结果(安装Multipass后)

我重新启动了我的机器,又试了一次。下面是输出:

Starting Snapcraft 7.5.2                                                       
Logging execution to '/home/raddev/.local/state/snapcraft/log/snapcraft-20230905-122819.559201.log'                                                            
Build environment project directory changed from '/tmp/electron-snap--12098-gH68rJiHPL7T', cleaning first.
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
debconf: delaying package configuration, since apt-utils is not installed
update-alternatives: using /usr/lib/shim/shimx64.efi.signed.latest to provide /usr/lib/shim/shimx64.efi.signed (shimx64.efi.signed) in auto mode
find: ‘’: No such file or directory
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.15.0-213-generic
Warning: couldn't identify filesystem type for fsck hook, ignoring.
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/40-force-partuuid.cfg'
Sourcing file `/etc/default/grub.d/50-builddimg-settings.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.15.0-213-generic
Found initrd image: /boot/initrd.img-4.15.0-213-generic
Found linux image: /boot/vmlinuz-4.15.0-212-generic
Found initrd image: /boot/initrd.img-4.15.0-212-generic
Adding boot menu entry for EFI firmware configuration
done
mesg: ttyname failed: Inappropriate ioctl for device
debconf: delaying package configuration, since apt-utils is not installed
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
mesg: ttyname failed: Inappropriate ioctl for device
Source path "/tmp/electron-snap--17336-k666maUgfaKI" does not exist
An error occurred with the instance when trying to mount with 'multipass': returned exit code 1.
Ensure that 'multipass' is setup correctly and try again.
/home/raddev/dev/electron/CYaPass-Electron/node_modules/@malept/cross-spawn-promise/dist/src/index.js:99
                reject(new ExitCodeError(cmd, args, code, stdout, stderr));
                       ^

ExitCodeError: Command failed with a non-zero return code (2):
/usr/bin/snapcraft snap --output=/home/raddev/dev/electron/CYaPass-Electron/out/CYaPass-linux-x64/cyapass_1.4.4_amd64.snap
    at ChildProcess.<anonymous> (/home/raddev/dev/electron/CYaPass-Electron/node_modules/@malept/cross-spawn-promise/dist/src/index.js:99:24)
    at ChildProcess.emit (node:events:514:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5) {
  cmd: '/usr/bin/snapcraft',
  args: [
    'snap',
    '--output=/home/raddev/dev/electron/CYaPass-Electron/out/CYaPass-linux-x64/cyapass_1.4.4_amd64.snap'
  ],
  stdout: '',
  stderr: '',
  code: 2
}

我肯定是陷在兔子洞里了。我假设这只是你不能在Ubuntu 22.04.2 LTS上运行的事情之一。

在纯Debian上尝试-同样的失败我在VirtualBox上安装了Debian(5.10.179-1)并启动了它。我安装了所有的依赖项(node,npm,Snapcraft等),并克隆了我的项目并运行npm run make所有的失败都是完全相同的。

这不是构建快照的有效方法--我猜没有人尝试过这种方法。祝所有想尝试它的人好运。
以下是错误(无法从VM复制,因此我必须拍摄快照):

bweufnob

bweufnob1#

我直接使用snapcraft实用程序跟踪了the docs for creating a snap
我的snapcraft.yaml是基于示例的,看起来像下面这样:

name: cyapass # you probably want to 'snapcraft register <name>'
base: core22 # the base snap is the execution environment for this snap
version: '1.44' # just for humans, typically '1.2+git' or '1.3.2'
summary: Never type, memorize or make up  a password again.  # 79 char long summary
description: |
  C'YaPass generates your passwords every time so they are never stored anywhere.
  
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots

parts:
  cyapass-tar:
    # See 'snapcraft plugins'
    source: autotools
    plugin: ./cyapass.tar.gz

底座:core22在这里很重要。

我运行snapcraft,它应该构建快照,但它抛出了一个错误。我得到以下错误:
插件未注册
我找到了这个explanation of why it fails
所以很明显,它不会在Ubuntu 22.0.4.2 LTS上运行。
他们已经一年多没有对这个问题做任何记录了。
任何人都可以创建一个快照包吗?我不确定.
我试着修改了这个值,并将其设置为core20(也是一个有效的基数)。然而,这在系统中进一步沿着(在多遍运行之后),因此似乎没有任何解决方案。
现在,在我看来...你不能从这里到那里。

相关问题