- 进程间通讯报 No handler registered 错误,结果发现是ipcMain.handle(或者ipcMain.on)放到主程序其中的函数里面了,拿出来就不报错了。或者放到 app.whenReady()一级的函数里也不会报错。
make时报错,主要是进程间通讯,自定义的API,报没有定义,结果是新增加了一个文件 type.d.ts,内容如下:
export {} declare global { interface window { electronAPI: any; } }
同时,在使用的页面randerer.ts中增加引用:
declare const window:any;
就OK了- 在electron中,引入外部css或js文件
在electron中引入bootstrap,但是总是提示:because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled错误,一直以为是csP问题,其实是文件在测试过程中没有放到正确的目录下,在webpack中,要放到".webpack/renderer"目录下。 - 报错Error: Could not find any Electron packages in devDependencies 报错:.../node_modules/electron postinstall$ node install.js ... ... RequestError: connect ETIMEDOUT 20.205.243.166:443
修改了源:npm config set registry http://registry.npmmirror.com
也可以用文本编辑工具直接修改:npm config edit
添加:
electron_mirror=https://npmmirror.com/mirrors/electron/ - npm run make时报错:Making a squirrel distributable for win32/x64 Failed with exit code "4294967295"
原来在vscode的终端里直接运行命令,以管理员方式起一下新终端运行就成功了。注意一定要关闭杀毒软件!!!
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。