electron-packager

Signing a Windows installer (.exe) for application created using Electron

一个人想着一个人 提交于 2019-12-06 02:28:47
I have a simple app built using Electron framework . I packaged the code using electron-packager-interactive . I also created a Windows installer file which is ready for distribution using Inno Setup compiler (Single .exe file). The problem here is when users run the .exe file, a popup from Windows Smart screen blocks it saying publisher is unknown . Only after "More info", it allows to install with " Run anyway ". Probably it's because my application is not signed . So can anyone help me how to sign an Electron application (Windows application) so that it's treated as trusted application ?

Electron-packager: can not locate local db file after packing

断了今生、忘了曾经 提交于 2019-12-04 14:53:19
Background: In my app, I have a local DB file, named example.db which is read by the main.js . The project structure and part of my main.js program is shown below. Project folder architecture main.js const { app, BrowserWindow, dialog, Menu } = require('electron') const fs = require('fs') const path = require('path') const sqlite3 = require('sqlite3').verbose() // load dataBase let dbFile = 'app/db/example.db' const db = new sqlite3.Database(dbFile) Package.json { "name": "Example", "version": "1.0.0", "description": "", "main": "./app/main.js", "scripts": { "postinstall": "install-app-deps",

'electron-packager' is not recognized as an internal or external command

杀马特。学长 韩版系。学妹 提交于 2019-12-03 07:16:29
I recently started using electron. I have successfully completed the 1st phase by creating a hello world app (included files index.html, main.js, package.json). Now I am trying to package the app using electron-packager but getting this error Steps I have followed: Created a project directory named helloworld. Initialized the project directory using npm init command. Then installed electron using npm install electron --save-dev . Then created the javascript and html files as main.js and index.html respectively. Then used npm start to execute the application. Then installed electron-packager

How to reduce Electron package size that exceeds more than 600 mb

会有一股神秘感。 提交于 2019-12-02 18:50:12
问题 I see this is because of node-modules and application is packaged with some unwanted stuffs for running. Current file size is 600 mb but I want it to be less than 200 mb. I suspect --no-prune populates all the node-modules in package that is built, but I need only specifies node-modules in the package that is built I tried removing unwanted packages in package.json, it doesn't help me either after refactoring "bundledDependencies": [ "fs", "os", "path", "regedit", "request", "start", "xml2js"

How to reduce Electron package size that exceeds more than 600 mb

点点圈 提交于 2019-12-02 09:50:33
I see this is because of node-modules and application is packaged with some unwanted stuffs for running. Current file size is 600 mb but I want it to be less than 200 mb. I suspect --no-prune populates all the node-modules in package that is built, but I need only specifies node-modules in the package that is built I tried removing unwanted packages in package.json, it doesn't help me either after refactoring "bundledDependencies": [ "fs", "os", "path", "regedit", "request", "start", "xml2js", "util", "replace", "process", "fs", "console" ], **before refactoring** "bundledDependencies": [

Can we launch a node command on a mac without node installed when using electron-packager?

拟墨画扇 提交于 2019-12-02 04:04:06
When I package an electron app using electron-packager. The app spawns a child process which uses a 'node' command. Now if I try to launch my app in a system with no node installed on it, does the app work? I have been trying to achieve this and facing various issues, the electron community suggested me to use fork method, spawn method with 'Process.execPath' as command and also setting the ELECTRON_RUN_AS_NODE variable but nothing seems to work on my end. Now after doing all this I question myself, do I definitely need node installed on my system to run the app? or is there really a way that

How to run and pack external executable using Electron?

喜你入骨 提交于 2019-11-30 21:54:19
For example, I have a compiled binary cudaDeviceQuery which returns a list of devices as JSON. Here's a piece of code: export default function cudaDeviceQuery(): Promise<CollectorResponse> { const throwError = () => { throw new Error("Unfortunately your platform isn't yet unsupported"); }; const file = __DARWIN__ ? path.join(__dirname, 'darwin', 'cudaDeviceQuery') : __WIN32__ ? path.join(__dirname, 'win', 'cudaDeviceQuery.exe') : throwError(); const descriptor = spawn(file); return new Promise((resolve, reject) => { let outerData = ''; descriptor.stdout.on('data', data => { outerData += data;

How to run and pack external executable using Electron?

江枫思渺然 提交于 2019-11-30 18:10:40
问题 For example, I have a compiled binary cudaDeviceQuery which returns a list of devices as JSON. Here's a piece of code: export default function cudaDeviceQuery(): Promise<CollectorResponse> { const throwError = () => { throw new Error("Unfortunately your platform isn't yet unsupported"); }; const file = __DARWIN__ ? path.join(__dirname, 'darwin', 'cudaDeviceQuery') : __WIN32__ ? path.join(__dirname, 'win', 'cudaDeviceQuery.exe') : throwError(); const descriptor = spawn(file); return new

打包Electron项目

和自甴很熟 提交于 2019-11-28 10:21:38
先确保该项目正常运行npm run dev,结束程序, 上篇的项目运行已经提到了打包输出工具electron-packager 可以使用 全局 安装的方式:     npm install -g electron-packager 也可以使用当前项目 局部 安装的方式:npm install save-dev electron-packager 安装好后,执行 electron-packager . myClient --win --out ../electron-api-demos-master --arch=x 64 --app-version=0.0.1 --electron-version= 6.0.3 来打包项目, 或者将该命令配置到package.json文件的scripts中 注意:标红的地方》myClient是生成后的exe文件名(可自定义),../electron-api-demos-master是生成文件的路径(一般输出到项目根目录下),64指本电脑的操作系统几位,6.0.3是electron的版本号 执行成功后的这句【Wrote new app to ..\electron-api-demos-master\myClient-win32-x64】就是生成文件的相对路径,如图 点进去便可看到生成的所有文件,包括exe文件,双击便可看到窗体效果了

electron 前端开发桌面应用

ⅰ亾dé卋堺 提交于 2019-11-27 15:22:28
electron 是由Github开发,是一个用Html、css、JavaScript来构建桌面应用程序的开源库,可以打包为Mac、Windows、Linux系统下的应用。 快速开始 接下来,让代码来发声,雷打不动的 hello world 创建文件夹,并执行 npm init -y ,生成 package.json 文件,下载 electron 模块并添加开发依赖 mkdir electron_hello && cd electron_hello && npm init -y && npm i electron -D 下载速度过慢或失败,请尝试使用cnpm,安装方式如下 # 下载cnpm npm install -g cnpm --registry=https://registry.npm.taobao.org # 下载electron cnpm i electron -D  创建index.js,并写入以下内容 const {app, BrowserWindow} = require('electron') // 创建全局变量并在下面引用,避免被GC let win function createWindow () { // 创建浏览器窗口并设置宽高 win = new BrowserWindow({ width: 800, height: 600 }) // 加载页面 win