问题描述
我的代码很简单:
const { Worker } = require('worker_threads');
let script = `console.log('working...');`;
new Worker(script,{ eval: true });
我可以在控制台中看到 working...
输出,但是当我使用 command+q
退出程序时,我在控制台中看到一个异常:my-electron-app/node_modules/_electron@11.3.0@electron/dist/Electron.app/Contents/MacOS/Electron exited with signal SIGSEGV
当我使用 sudo npm start
运行时,我还会看到一个关于 Electron quit unexpectedly
的弹出窗口
- 电子版本:11.3.0
- 操作系统:macOS 11.2
- 节点:12.18.3
- 铬:87.0.4280.141
复制
git clone https://github.com/Vict0r-Chen/electron-worker-threads.git
npm install
-
npm start
|sudo npm start
解决方法
根据这个information,使用npm install electron 12.0.0@beta --save-dev
将electron升级到v12.0.0
可以解决这个问题。