electron-builder - only build for mac but set to build mac and win
electron-builder defaults to building for the current platform. To build both, you need to do something like this in the "script", to build the mac and the window:
"dist-all": "electron-builder -mw"
sooon
I develop IOS apps and games, Web apps and my hobby is digital 3D sculpting. I am using XCode, Unity3D, Blender and ZBrush in daily basis.
Updated on June 14, 2022Comments
-
sooon almost 2 years
This is the first time I am building
electronjs
app so most probably I don't know what I am doing.I follow the instruction from the
github
and this. This is mypackage.json
:{ "name": "ExampleApp", "productName": "ExampleApp", "version": "1.0.0", "description": "Fun app.", "license": "MIT", "repository": "user/repo", "author": { "name": "sooon", "email": "[email protected]", "url": "Example.com" }, "build": { "appId": "com. Example.ExampleApp", "mac": { "target": "dmg", "icon": "build/icon.png" }, "win": { "target": "nsis", "icon": "build/icon.png" } }, "scripts": { "test": "xo", "start": "electron .", "pack": "electron-builder --dir", "dist": "electron-builder" }, "dependencies": { "electron-debug": "^1.0.0", "jquery": "^3.3.1" }, "devDependencies": { "devtron": "^1.1.0", "electron": "^1.8.2", "electron-builder": "^19.56.0", "electron-packager": "^8.7.2", "xo": "^0.18.0" }, "xo": { "envs": [ "node", "browser" ] } }
As you can see I have
mac
andwin
in thebuild
script. But when I run:nom run dist
only
DMG
file (fully functional) is build. There is not trace of any work withwin
app. What had I miss out in the setting?I am building this with my MacBook running on
10.12.6
. Is it only you can build for your own platform? CanMac
build forWindows
?Update01 I took out:
"build": { "appId": "com.sooonism.pipidance", "mac": { "target": "dmg", "icon": "build/icon.png" }, "win": { "target": "nsis", "icon": "build/icon.png" } },
from the
package.json
and it still build ok. That means thebuild
script is located somewhere maybe? -
Nic Barker over 5 yearsThanks, this fixed the problem for me. I don't know why it isn't mentioned in the docs anywhere.
-
sooon over 5 yearsI haven't tried this though. what platform did you use to build?
-
Nic Barker over 5 years@sooon I was able to build both mac .dmg and windows nsis apps on mac os x using
electron-builder -mw
-
Kywillis over 3 yearsI had the exact same problem. Flushed 2 hours down the toilet on this. This seems like something worth mentioning prominently in the documentation.