我正在尝试启动任何电子应用程序。当我只是尝试用npm start
运行应用程序时,我得到了一个错误Running as root without `--no-sandbox` is not supported
,我将启动脚本从"electron ."
编辑到"electron --no-sandbox ."
,并得到了新的错误The futex facility returned an unexpected error code./mnt/c/Users/Oleg/electron-quick-start/node_modules/electron/dist/electron exited with signal SIGABRT
。我在谷歌上找不到这个问题的答案,请大家帮忙。我的环境是:Windows 10 2004,Ubuntu 18.04 LTS,Node.js 12,Visual Studio代码
我最近在尝试使用WSL2运行Electron应用程序时遇到了这个问题。
所需物品汇总:
- XSERV在Windows上运行以运行Linux GUI应用程序(例如电子应用程序(
- 从远程WSL子系统正确识别DISPLAY
获取XSERVER
我使用https://sourceforge.net/projects/vcxsrv/.下载并安装。
确保正确识别显示器
从WSL终端运行
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
授权问题
Authorization required, but no authorization protocol specified
查看下面的GitHub问题,以进一步了解如何为XSERVER创建启动脚本来解决授权问题。
https://github.com/microsoft/WSL/issues/4793#issuecomment-588321333
注意:我不需要执行就可以让我的设置正常工作。上面的DISPLAY命令正确地识别了我的主机,所以这个命令是不必要的:
export DISPLAY=$WSL_IF_IP:0