I am trying to fix a tricky production issue in electron app.
And electron-builder takes around 5-6 minutes to build
project.app
project.dmg
project.mac.zip and so on.
Is there I can only build project.app and save time by not building .dmg file etc ?
Just add dir as target in your package.json
"build": {
"appId": "app.id",
"mac": {
"category": "your.app.category.type",
"target": "dir"
}
}
Not sure if you can avoid dmg and mac and only serve .app files but you can avoid generating both dmg and zip file by specifying the target option in mac build config
"mac": {
"target": [
"dmg"
],
},
If none of this work, you can always use a script to clean the .app file, run electron-builder as background process, then check until the .app file is built, kill the electron-builder process.
Related
I'm working on generating a Freebsd application with Electron builder. If I specify "freebsd" target in the electron-builder.json
"linux": {
"icon": "dist/assets/icons",
"target": [
"freebsd"
]
}
After the build, I receive a file with the ".freebsd" extension, but Freebsd considers this file as ".xz" archive. If I decompress this archive and try to execute the main application file I receive:
execvp: Exec format error
Is there a way to work with "*.freebsd" extension? If no for what this "freebsd" target in Electon builder at all?
I have been using electron to make desktop application for a while now but still can't figure out how it can be packaged for all the available linux distributions
For ALL linux distributions I have no idea. The way I make mine Linux Electron projects is just
npm install --save-dev electron-builder
add this to the root of my package.json
"build": {
"appId": "com.myname.appname",
"asar": true,
"mac": {
"category": "public.app-category.developer-tools"
}
},
I make a build folder in the root and put
icon.icns
icon.ico
which I built from this site
and then
./node_modules/.bin/electron-builder
it puts an .AppImage file in dist
more instructions here
Electron packager has packaged my app.But it doesn't have all the node modules as present in my app before packaging. I am forced to manually run npm install inside my packaged folder.
So, the app is not able to perform as expected.
I tried inside package.json
"build": {
"files": [
"/node_modules/**",
"package.json"
]
}
It looks like you are using your package.json wrong way.
Only "dependencies" will be included to the build if you put some package to "devDependencies" it will be excluded from the build.
use no-prune in build using electron packager and place all the modules inside devDependencies and then build the app.
I have successfully built an Electron app. Now I'm trying to change the icon of the .exe that is generated by electron-packager. However, the .exe gets the default Electron icon, not my own icon (see screenshot).
The command I run: npm run build
The corresponding script in package.json:
"build": "electron-packager --out winx64 --overwrite --platform win32 --appname clientlmcenter . --icon my_logo.ico"
The file my_logo.ico is present in the root directory.
You have to put icon argument like this
--icon=./my_logo.ico
Also make sure the logo is in the current directory where you execute npm run build
Another solution that I found is adding the icon in the packaje.json taking into account that the icon is in the root.
{
"name": "nameAplication",
"version": "1.0.0",
"icon": "favicon.ico",
}
and when creating the executable add this command
electron-packager . --platform=win32 --arch=x64 --icon=favicon.ico
I have problem with project(https://github.com/Gordienko-RU/plant-log), there are angular bundle in dist folder and electron main file into electron folder, but after packaging with electron-builder, application doesn't run.
I guess there are some problems with my config in to package.json
Ok, I had a similar issue with electron-packager. I tried your package.json and did a "npm install". To me it looks like that your build does include native addons (*.node).
In electron-packager the solution was to add the asar unpack option. You are using electron-builder. Therefore you should look at this thread: https://github.com/electron-userland/electron-builder/issues/390 . Maybe you need to specify the modules by hand, like:
"asar": true,
"asarUnpack": [
"../node_modules/uws"
]