一次debug临时放着
解决electron遇见Not allowed to load local resource:
// 关闭同源策略,调试用
new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
webSecurity: false
}
})
声网相关
=>环境报错:
Uncaught Error: The module '\\?\D:\comein\desktopApp\node_modules\agora-electron-sdk\build\Release\agora_node_ext.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at process.module.(:9080/anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:740)
at Object.module.(:9080/anonymous function) [as .node] (ELECTRON_ASAR.js:166:20)
at Module.load (internal/modules/cjs/loader.js:620)
at tryModuleLoad (internal/modules/cjs/loader.js:559)
at Function.Module._load (internal/modules/cjs/loader.js:551)
at Module.require (internal/modules/cjs/loader.js:658)
at require (internal/modules/cjs/helpers.js:20)
at Object. (D:\comein\desktopApp\node_modules\agora-electron-sdk\js\Api\index.js:5)
at Object. (D:\comein\desktopApp\node_modules\agora-electron-sdk\js\Api\index.js:1895)
解决:
yarn add electron-rebuild --dev
./node_modules/.bin/electron-rebuild // 这里我直接执行这个指令不成功
// 直接找到目路地址(./node_modules/.bin/electron-rebuild)
// 双击electron-rebuild.cmd文件
// 继续执行yarn run dev,会提醒使用electron-win32平台,执行指令:
npm install --arch=ia32 electron@3.0.6 -d // 成功
// 之前掉坑里,一直执行下面两段指令一直不成功,在放弃的时候,执行了npm,奇迹的可以了
// yarn add --arch=ia32 electron@3.0.6 不成功
// cnpm install --arch=ia32 electron@3.0.6 -d 不成功
=>Agora SDK for Electron 前提条件:
请确保满足以下开发环境要求:
Node.js 6.9.1 及以上
Electron 1.8.3 及以上
使用 Windows 平台进行开发时,请运行 npm install --arch=ia32 electron@3.0.6 -d
注:如果你选择官网下载并引入的方式,请务必使用 Eletron 3.0.6。
=>打包白屏
Uncaught Error: Cannot open D:\comein\desktopApp\node_modules\agora-electron-sdk
\build\Release\agora_node_ext.node:
Error: D:\comein\desktopApp\node_modules\agora-electron-sdk\build\Release
\agora_node_ext.node is not a valid Win32 application.
D:\comein\desktopApp\node_modules\agora-electron-sdk\build\Release\agora_node_ext.node
解决:
修改package.json文件:
"scripts": {
- "build": "node .electron-vue/build.js && electron-builder",
+ "build": "node .electron-vue/build.js && electron-builder --platform=win32 --arch=ia32",
},