vue 3 + electron 简单示例不起作用
vue 3 + electron simple example not working
我尝试使用 vuejs 3
构建示例 electron
应用程序。我在 Debian Buster,运行ning 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
开箱即用...
还有其他建议吗?
最近有一份关于同样问题的 Electron 错误报告:#17972。
降级到 Electron 4.x 是一种可能的解决方案。
提到了另一个解决方法,它启用 "user namespace sandboxing" 而不是 "SUID sandbox":
sudo sysctl kernel.unprivileged_userns_clone=1
据说此选项在 Ubuntu 上默认启用,但在 Arch Linux 上未启用,显然在您的 Debian 系统上也未启用。要使更改永久生效,您可以使用以下内容创建 /etc/sysctl.d/electron.conf
:
kernel.unprivileged_userns_clone = 1
我尝试使用 vuejs 3
构建示例 electron
应用程序。我在 Debian Buster,运行ning 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
开箱即用...
还有其他建议吗?
最近有一份关于同样问题的 Electron 错误报告:#17972。
降级到 Electron 4.x 是一种可能的解决方案。
提到了另一个解决方法,它启用 "user namespace sandboxing" 而不是 "SUID sandbox":
sudo sysctl kernel.unprivileged_userns_clone=1
据说此选项在 Ubuntu 上默认启用,但在 Arch Linux 上未启用,显然在您的 Debian 系统上也未启用。要使更改永久生效,您可以使用以下内容创建 /etc/sysctl.d/electron.conf
:
kernel.unprivileged_userns_clone = 1