Reputation: 8979
I'm using electron v6.0.9 with electron-builder v21.2.0. Here is the packaging configuration from my package.json
for a production build.
"build": {
"appId": "com.app.prototype",
"productName": "Pluto",
"copyright": "Copyright © 2018 Simon Inc.",
"mac": {
"target": [
"zip"
]
},
"win": {
"publisherName": "Simon Inc.",
"target": [
"nsis",
"zip"
]
},
"linux": {
"target": [
"AppImage",
"tar.gz"
]
},
"dmg": {
"icon": "build/icon.icns"
},
"publish": {
"provider": "generic",
"url": "THE_RELEASE_URL_HERE",
"channel": "latest",
"publishAutoUpdate": true
}
},
I configured the build script as "pack": "electron-builder --dir -mwl",
in script
. The issue is, when i run the command npm run pack
, it packages the application for all the platform, but for windows there is no single installer file either .exe
or '.msi'. electron-builder
builds bunch of files for windows.
I'm running on macOS High Sierra v10.13.6 (17G8030). I also tried building on windows 10 system but outcome is the same. is anything misconfigured here or there some more steps required to generate single installer file for windows?
Upvotes: 7
Views: 10906
Reputation: 8979
I figured it out about how to build a standalone installer from electron source rather than having a bunch of files. Actually we have to use electron-builder
with -p
.
Here is the build configuration in my package.json file.
"build": {
"appId": "com.trinityinfosystem.accurate",
"productName": "Accurate",
"copyright": "Copyright © 2018 Trinity InfoSystem",
"mac": {
"target": [
"zip"
],
"publish": [
"github"
]
},
"win": {
"publisherName": "Trinity InfoSystem",
"publish": [
"github"
],
"target": [
"nsis"
]
},
"linux": {
"target": [
"AppImage",
"tar.gz"
]
},
"dmg": {
"icon": "build/icon.icns"
},
"publish": [
{
"provider": "github",
"owner": "vkiranmaniya",
"repo": "accurate",
"vPrefixedTagName": true,
"private": true,
"releaseType": "draft"
}
]
}
then i just used electron-builder -p never --win
and it packed up the .exe file in project_root/dist directory. You can use -p always
if you are using auto-updator
from electron-builder
and want to publish a release draft in github repository.
If you want to override default install location and let the user choose it, make sure you have configured the nsis
build as follow,
"nsis": {
"oneClick": false,
"perMachine": false,
"allowToChangeInstallationDirectory": true
},
Upvotes: 6