使用 electron13 + electron-react-boilerplate 一些包报错+native包问题
能run起来的最粗暴的方式就是
把nodeIntegration打开,把contextIsolation关掉。
1 | const config: BrowserWindowConstructorOptions = { |
如果装native包,务必在 app/release/下安装,并且要使用 npm 而不是yarn.
electron-react-boilerplate 使用的rebuild版本有问题,直接升级到最新版本。
未解决问题。 基于ffi-napi 多次调用win32的方法,QueryDisplayConfig,node进程会直接中断退出。
1 | import log from 'electron-log' |
mac需要动态不引入win32的native包(会报错)
需要安装node-gyp构建环境(开发机 & 打包机)
https://github.com/nodejs/node-gyp#on-windows
python 3.9 安装 + 环境变量(要选给all users 安装)
npm config set python “C:\Programs\Python\Python39\python.exe”
npm install windows-build-tools -g
卡住解决:https://www.jianshu.com/p/e2f12fab2b78
参考资料文档:
如何实现外界屏幕模式切换
https://blog.csdn.net/wangyunman/article/details/103080818
调用Windows API:SetDisplayConfig
调用displayswitch.exe 可以实现,但是会有一个切换的系统级UI变化,https://renenyffenegger.ch/notes/Windows/dirs/Windows/System32/DisplaySwitch_exe#:~:text=DisplaySwitch.exe%20can%20be%20used,the%20windows%2Bp%20keyboard%20shortcut.
在 Electron 下调用 Win32 API 的经历
node 如何执行 windows API
https://github.com/waitingsong/node-win32-api
外部函数接口 FFI —— 虚拟机中重要但不起眼的组件
https://zhuanlan.zhihu.com/p/32134367
node.js + Electron 调用 Windows API 踩坑日记
https://blog.csdn.net/qq_21487663/article/details/111099822
electron怎么调用windows的api?
问题:
- electron 安装native包报错
- win32-api没有这个方法
https://juejin.cn/post/6854573212341108749#heading-9
https://blog.csdn.net/YW_yang/article/details/117434122
https://www.cnblogs.com/silenzio/p/11639960.html
锁版本, 统一 编译需要的C++版本,python版本