【问题标题】:Running Electron with Linux on Windows在 Windows 上使用 Linux 运行 Electron
【发布时间】:2020-03-22 16:30:28
【问题描述】:

我正在尝试通过 Windows 上的 Linux 在我的 Windows 10 机器上运行电子锻造应用程序(使用新的内置 Windows bash 功能)。

在运行electron-forge start 时,我收到了错误消息:

[1484:1126/222326.466455: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 /mnt/c/.../node_modules/electron/dist/chrome-sandbox is owned by root and has mode 4755.

通过一些搜索,这个thread on the electron Github 清楚地表明这是设计使然,解决它的方法是在安装所有依赖项后以 root 用户身份运行 chmod。

我尝试执行此操作,并且该命令看起来有效(将 chmod 运行到 4755 时没有错误),但这并不能修复运行 electron-forge start - 我仍然收到相同的错误消息。我调查了一下,似乎这与允许 linux 子系统控制每个 this Microsoft thread 的权限的文件有关。

还有其他技巧可以让 electron forge 在 Windows 上与 bash 一起工作吗?

【问题讨论】:

    标签: windows electron windows-subsystem-for-linux electron-forge


    【解决方案1】:

    我发现从 Windows powershell 运行 electron-forge init 到本机 Windows 目录允许我随后在 WSL 中使用 my-app 中的 npm start(例如)。所以最终我跑的是

    powershell npx create-electron-app my-app
    

    (我的 .bashrc 文件中有 alias powershell="/mnt/c/windows/system32/WindowsPowerShell/v1.0/powershell.exe"

    【讨论】:

      猜你喜欢
      • 2020-07-02
      • 1970-01-01
      • 2019-05-27
      • 1970-01-01
      • 2018-12-17
      • 2011-09-03
      • 2017-02-01
      • 2013-01-20
      • 2015-02-26
      相关资源
      最近更新 更多