Win10 Electron Error: Passthrough is not supported, GL is disabled, ANGLE is

Win10 Electron Error: Passthrough is not supported, GL is disabled, ANGLE is

我有一个 electron repo (https://github.com/MartinBarker/RenderTune),当 运行 使用命令提示符时,它曾经在 windows 10 上正常工作。几个月后,我回来使用带有 Nvidia GPU 的全新 windows 10 机器,电子应用程序在启动时在 window 中打印错误:

Uncaught TypeError: Cannot read properties of undefined (reading 'getCurrentWindow')

运行 ffmpeg shell 命令也会导致错误,并且在命令提示符终端中输出此消息:

[14880:1207/145651.085:ERROR:gpu_init.cc(457)] Passthrough is not supported, GL is disabled, ANGLE is

我检查了我的其他 Windows 笔记本电脑 运行 与我的存储库的主 b运行ch 完全相同的代码,当 运行 本地。

这似乎是最近才出现的问题?我发现它在各种论坛上都有讨论: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1944468

https://www.reddit.com/r/electronjs/comments/qdauhu/passthrough_is_not_supported_gl_is_disabled_angle/

我尝试将我的全局电子 npm 包升级到更新的版本:electron@16.0.4,但错误仍然出现。

您可以尝试使用 app.disableHardwareAcceleration() (See the docs) 禁用硬件加速。不过,我认为这不是解决方法,它只是让消息对我消失了。


用法示例

main.js

import { app, BrowserWindow } from 'electron'
import isDev from 'electron-is-dev'

app.disableHardwareAcceleration()

let win = null

async function createWindow() {
  win = new BrowserWindow({
    title: 'My Window'
  })

  const winURL = isDev
    ? 'http://localhost:9080'
    : `file://${__dirname}/index.html`
  win.loadURL(url)

  win.on('ready-to-show', async () => {
    win.show()
    win.maximize()
  })
}

app.whenReady().then(createWindow)

app.on('window-all-closed', () => {
  win = null
  if (process.platform !== 'darwin') {
    app.quit()
  }
})