当前位置:网站首页>Electron使用romote报错 : Uncaught TypeError: Cannot read property ‘BrowserWindow‘ of undefined
Electron使用romote报错 : Uncaught TypeError: Cannot read property ‘BrowserWindow‘ of undefined
2022-07-30 05:50:00 【HW-Header】
今天在学习electron
当中的remote
模块时,遇到了一个巨坑:remote模块不存在。在国内的问答网站中皆未找到解决办法,最后在stack overflow中找到了解决办法,在此留下足迹,帮助其他伙伴。
原因很简单,在Electron 10.x中,enableRemoteModule
的默认值为false,也就是默认情况下是不支持使用remote
模块的,因此使用remote模块的应用程序需要将enableRemoteModule
显式设置为true。
mainWindow = new BrowserWindow({
width:400,
height:400,
webPreferences: {
nodeIntegration: true, // 集成node环境
enableRemoteModule: true // 使用remote模块
}
}) //设置打开的窗口大小
边栏推荐
猜你喜欢
随机推荐
Playing script killing with AI: actually more involved than me
DHCP principle and configuration
让百度地图生成器里的“标注”内容展开--解决方案
AI元学习引入神经科学,医疗效果有望精准提升
C#的访问修饰符,声明修饰符,关键字有哪些?扫盲篇
Camera coordinate system, world coordinate system, pixel coordinate system conversion, and Fov conversion of OPENGLDEFocal Length and Opengl
Mobile phone side scroll to page to specify location
大厂年薪50w+招聘具有测试平台开发能力的测试工程师
新人误删数据,组长巧用MySQL主从复制延迟挽回损失
AI可通过X光片识别种族,但没人知道为什么
When does MySQL use table locks and when does it use row locks?
使用 Grafana 的 Redis Data Source 插件监控 Redis
(GGG)JWT
从追赶到超越,国产软件大显身手
DNS域名解析服务
New breakthrough in artificial muscle smart materials
万能js时间日期格式转换
Distance calculation from space vertex to straight line and its source code
Proof of distance calculation from space vertex to plane and its source code
MySQL主从复制配置搭建,一步到位