Javascript 要求electron中的节点opcua冻结electron实例
Electron在index.html中需要时冻结,称为Electron Helper的进程占用100%的cpu 我在macOS 10.14.2上遇到过这个问题,但我的一个朋友在Windows 10上进行了测试,结果证明了这一点 来自package.jsonJavascript 要求electron中的节点opcua冻结electron实例,javascript,electron,node-opcua,Javascript,Electron,Node Opcua,Electron在index.html中需要时冻结,称为Electron Helper的进程占用100%的cpu 我在macOS 10.14.2上遇到过这个问题,但我的一个朋友在Windows 10上进行了测试,结果证明了这一点 来自package.json "devDependencies": { "electron": "^4.0.4" }, "dependencies": { "node-opcua": "^0.5.6" } Main.js const { app, Br
"devDependencies": {
"electron": "^4.0.4"
},
"dependencies": {
"node-opcua": "^0.5.6"
}
Main.js
const { app, BrowserWindow } = require('electron')
function createWindow () {
// Create the browser window.
win = new BrowserWindow({ width: 800, height: 600 })
// and load the index.html of the app.
win.loadFile('index.html')
win.webContents.openDevTools()
}
app.on('ready', createWindow)
Index.html
<script>
// Does not work
const opcua = require('node-opcua')
console.log(opcua)
// Works
// const fs = require('fs')
// console.log(fs)
</script>
//不起作用
常量opcua=require('node-opcua')
console.log(opcua)
//工作
//常量fs=require('fs')
//console.log(fs)
当运行简单代码时,它应该只在控制台中打印opcua对象。但整个选举过程冻结了 通过将节点opcua更新为2.1.9和将electron更新为6.0.11解决了该问题通过将节点opcua更新为2.1.9和将electron更新为6.0.11解决了该问题