当前位置:网站首页>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模块
}
}) //设置打开的窗口大小
边栏推荐
- When does MySQL use table locks and when does it use row locks?
- Is it possible to use the same port for UDP and TCP?
- Linx常见目录&文件管理命令&VI编辑器使用 介绍
- prometheus-tls加密
- prometheus-basic_auth加密配置
- 开发常用工具软件
- Distance calculation from space vertex to straight line and its source code
- 相机坐标系,世界坐标系,像素坐标系三者转换,以及OPENGLDEFocal Length和Opengl 的 Fov转换
- 空间顶点到直线的距离计算及其源码
- 搭建vsftpd服务并实现本地用户访问
猜你喜欢
idea内置翻译插件
进程和计划任务管理
prometheus-federation-tls加密
What happens when @Bean and @Component are used on the same class?
Linx common directory & file management commands & VI editor usage introduction
STL源码剖析:bound friend template friend代码测试和理解
Rodrigues: vector representation of rotation matrices
Test and Development Engineer Growth Diary 009 - Environment Pai Pai Station: Development Environment, Test Environment, Production Environment, UAT Environment, Simulation Environment
LVM和磁盘配额
The Society of Mind - Marvin Minsky
随机推荐
新人误删数据,组长巧用MySQL主从复制延迟挽回损失
头条二面:MySQL中有几种常见的 SQL 错误用法?
不会吧,Log4j 漏洞还没有完全修复?
STL source code analysis: conceptual understanding of iterators, and code testing.
阿里二面:列出 Api 接口优化的几个技巧
Headline 2: there are several kinds of common SQL errors in MySQL usage?
Required request body is missing 问题解决
MySQL什么时候用表锁,什么时候用行锁?
MongoDB-CUD without R
上传文件--文件类型大全,图片类型,文档类型,视频类型,压缩包类型
首届人工智能安全大赛正式启动
The Society of Mind - Marvin Minsky
Dachang's annual salary of 50w+ recruits test engineers with test platform development capabilities
Test Development Engineer Growth Diary 001 - Some Introduction to Agile Testing, CI/CD/CT, DecOps
华为发布“十大发明”,包含计算、智能驾驶等新领域
What happens when @Bean and @Component are used on the same class?
软件测试_01
C#的访问修饰符,声明修饰符,关键字有哪些?扫盲篇
The Geometric Meaning of Vector Cross Product and the Calculation of Modulus
New breakthrough in artificial muscle smart materials