window.print() 没有打印机导致主进程在 Electron App 中崩溃

window.print() without printers causes the main process to crash in Electron App

我正在使用 Electron 和 react-js。每当我调用 window.print() 它都会显示弹出窗口,但如果我试图关闭它,它会导致崩溃并且整个 window 会自动关闭。

btn.onClick = (e) => { 
    e.preventDefault
    window.print()
}

/* dependencies */
'version' : '17.0.1' ,
"react": "^17.0.2" ,
"electron-squirrel-startup": "^1.0.0"

So, my question is how to fix it in the Electron app, and can I use silent print in react-js if yes how I can use it?

最近我找到了一个解决方案。我访问了 Electron site 他们刚刚发布了一个新的稳定版本的电子 17.1.1 他们也已经解决了这个问题。它在我的设备上工作正常 window 10

Type npm i electon@latest it'll install a newer version of Electron.