【问题标题】:vue 3 + electron simple example not workingvue 3 +电子简单示例不起作用
【发布时间】:2019-09-15 10:15:08
【问题描述】:

我尝试使用vuejs 3 构建一个示例electron 应用程序。我在 Debian Buster 上,运行 node 版本 v10.15.1

我或多或少地遵循了https://github.com/nklayman/vue-cli-plugin-electron-builder中给出的描述:

vue --version
3.6.3

vue create frontend
cd frontend/
npm run serve //everything is fine

vue add electron-builder
npx vue-cli-service electron:serve

dist_electron/index.js编译成功,但是在INFO Launching Electron...消息之后,什么都没有发生。

也许我认为我的electron 安装坏了:

./node_modules/electron/dist/electron --version
[29769:0426/003034.548566:FATAL:setuid_sandbox_host.cc(157)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /home/info/frontend/node_modules/electron/dist/chrome-sandbox is owned by root and has mode 4755.

按照 Cloud Soh Jun Fu 的建议,我尝试更改权限和所有权:

sudo chown root:root chrome-sandbox
sudo chmod 4755 chrome-sandbox

现在它按预期工作,但不知何故我对此感觉不太好......我的意思是,我只做了一些基本的事情,为此,我希望开箱即用electron......

还有其他建议吗?

【问题讨论】:

  • 我按照指南运行npm run electron:serve,它工作正常。您使用的是什么操作系统?尝试使用ls -al /home/info/frontend/node_modules/electron/dist/chrome-sandbox查看chrome-sandbox的权限。
  • 谢谢!我改变了问题。
  • 可能与您的用户有关。你运行npm install时的用户是什么?
  • 我认为 chrome 是通过vue add electron-builder 安装的,我以普通用户身份运行。此外,/home/info/frontend/node_modules/electron/dist/ 目录表明它是作为普通用户 info 安装的。

标签: vue.js electron electron-builder


【解决方案1】:

最近有一个关于同样问题的 Electron 错误报告:#17972

降级到 Electron 4.x 是一种可能的解决方案。

提到了另一种解决方法,它启用“用户命名空间沙盒”而不是“SUID 沙盒”:

sudo sysctl kernel.unprivileged_userns_clone=1

据说这个选项在 Ubuntu 上是默认启用的,但在 Arch Linux 上没有启用,显然你的 Debian 系统上也没有。要使更改永久生效,您可以使用以下内容创建 /etc/sysctl.d/electron.conf

kernel.unprivileged_userns_clone = 1

【讨论】:

    猜你喜欢
    • 2018-08-15
    • 1970-01-01
    • 2012-07-01
    • 2015-11-23
    • 2016-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多