electron

How to manage configuration for Webpack/Electron app?

霸气de小男生 提交于 2020-12-01 09:48:26
问题 I am using Webpack 2 and Electron to build nodejs application on Mac. In my project in the root I have directory 'data' where I store configuration in a json like data/configurations/files.json (in practices there are different files with dynamic names) After webpackaing though when I call: fs.readdirSync(remote.app.getAppPath()); to get files in the root I get only these packed: [ "default_app.js", "icon.png", "index.html", "main.js", "package.json", "renderer.js" ] path.join(remote.app

serialport for electron NODE_MODULE_VERSION error and rebuild does not fix

混江龙づ霸主 提交于 2020-11-29 18:58:02
问题 OS: win 10 Node.js : v12.18.3 electron: v10.1.1 print version from js program: process.versions.node 12.16.3 process.versions.modules 82 install serialport by: npm install serialport npm start and get error: Error: The module '\?\D:\node\Tester\node_modules@serialport\bindings\build\Release\bindings.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 72. This version of Node.js requires NODE_MODULE_VERSION 82. Please try re-compiling or re-installing the module

serialport for electron NODE_MODULE_VERSION error and rebuild does not fix

早过忘川 提交于 2020-11-29 18:56:54
问题 OS: win 10 Node.js : v12.18.3 electron: v10.1.1 print version from js program: process.versions.node 12.16.3 process.versions.modules 82 install serialport by: npm install serialport npm start and get error: Error: The module '\?\D:\node\Tester\node_modules@serialport\bindings\build\Release\bindings.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 72. This version of Node.js requires NODE_MODULE_VERSION 82. Please try re-compiling or re-installing the module

serialport for electron NODE_MODULE_VERSION error and rebuild does not fix

折月煮酒 提交于 2020-11-29 18:54:48
问题 OS: win 10 Node.js : v12.18.3 electron: v10.1.1 print version from js program: process.versions.node 12.16.3 process.versions.modules 82 install serialport by: npm install serialport npm start and get error: Error: The module '\?\D:\node\Tester\node_modules@serialport\bindings\build\Release\bindings.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 72. This version of Node.js requires NODE_MODULE_VERSION 82. Please try re-compiling or re-installing the module

Custom HTML Dialog in Electron

隐身守侯 提交于 2020-11-29 08:30:22
问题 How (or is it even possible) to use custom HTML dialogs in Electron? I know that Electron provides certain dialogs ( showMessageDialog , showErrorDialog ) but these do not seem to allow custom HTML. I do not wish to use native HTML dialogs ( dialog ) tag as it does not 'blend in' with the user interface. Any help would be much appreciated. Thanks! 回答1: You can create a BrowserWindow that's modal and, if you like, frameless. See http://electron.atom.io/docs/api/browser-window/. 回答2: Yes. On

electron打包分发

心不动则不痛 提交于 2020-11-29 00:33:53
原始的方式打包 下载对应的版本号的 Release Electron 然后把对应的项目方便整理成这样的目录结构(Windows下) node_modules 重新安装,不然可能启动失败 把整文件夹给别人就可以了如果想改名子可以用 改名工具rcedit 应用程序打包成一个文件 为了缓解windows路径名过长的问题(就是有可能无法顺利的进行copy),以及隐藏代码可以把应用打包成asar文件 (就相当于把文件夹压缩一下,而此种压缩Electron不用解压可以直接读取) 全局安装asar npm install -g asar 生成asar文件 asar pack your-app app.asar 拷到对应的文件夹下 electron/resources/ └── app.asar 1和2如果要想生成对应的安装包可以借用第三方安装包生成工具进行生成如 Inno Setup 如果本地安装那就需要写一个js脚本文件来执行 var asar = require('asar'); var src = '../electronpicture/'; //工程目录 var dest = 'app.asar'; //输出 asar.createPackage(src, dest, function() { console.log('done.'); }) 借助第三方打包工具

electron---项目打包

余生颓废 提交于 2020-11-28 23:56:56
创建一个应用目录:app,里面需要有必要的三个文件: index.html <! DOCTYPE html > < html > < head > < meta charset ="UTF-8" > < title > 百度 </ title > < style type ="text/css" > * { margin : 0px ; padding : 0px ; } #iframe { width : 100% ; height : 100% ; position : absolute ; top : 0px ; right : 0px ; bottom : 0px ; left : 0px ; } </ style > </ head > < body > < iframe id ="iframe" frameborder ="0" src ="https://www.baidu.com/" ></ iframe > < script > // You can also require other files to run in this process require( ' ./renderer.js ' ) </ script > </ body > </ html > main.js // Modules to control application life and

electron之打包成安装程序

允我心安 提交于 2020-11-28 23:56:38
1、安装 electron-winstaller    npm install --save-dev electron-winstaller 2、创建一个build.js var electronInstaller = require('electron-winstaller'); var path = require("path"); resultPromise = electronInstaller.createWindowsInstaller({ appDirectory: path.join('./out/haha-win32-x64'), //入口 outputDirectory: path.join('./tmp/build/installer64'), //出口 authors: 'yyt', exe: 'haha.exe', //名称 setupIcon: path.join('icon.ico'),//安装图标,必须本地 iconUrl: 'http://pm72qibzx.bkt.clouddn.com/icon.ico',//程序图标,必须url noMsi: true, }); resultPromise.then(() => console.log("It worked!"), (e) => console.log(`No dice: ${e

electron安装与打包

对着背影说爱祢 提交于 2020-11-28 09:27:44
安装cnpm镜像 npm install cnpm -g --registry=https://registry.npm.taobao.org 全局安装electron cnpm install -g electron 新建一个index.js 生成一个package文件 cnpm init --yes // --yes表示全部默认设置 nodejs代码提示 npm install --save-dev @types/node 运行electron electron . 下面开始打包: 打包的格式: electron-packager <应用目录> <应用名称> <打包平台> --out <输出目录> <架构> <应用版本> cnpm install electron-packager -g package.json 中 "scripts" 属性配置如下: "start": "electron .", "package": "electron-packager . 3dmax --win --out ../HelloWorldApp --arch=x64 --electron-version=11.0.3" 经过上面步骤后,输入如下命令: 在终端控制台上运行, npm run-script package 打包结果: 如果更换打包后应用图标: 这里要注意,图标格式必须是ico格式的

Run Electron without GUI

无人久伴 提交于 2020-11-28 08:12:11
问题 I see this question has been asked but the context of that question is different and so there are no answers relavent to my use case so I'm asking a new question I have an Electron based Web Server. It's meant for beginning web developers, students, and artists that are not used to the command line (yes that's a huge debate right there but I was scolded by the teachers at the Art and Design School at UCLA for asking their students to use the command line, hence a simple server with a GUI.