Windows 使用electron builder从electron应用程序生成standalone.exe

Windows 使用electron builder从electron应用程序生成standalone.exe,windows,macos,electron,installation,electron-builder,Windows,Macos,Electron,Installation,Electron Builder,我正在使用electron v6.0.9和electron builder v21.2.0。以下是我的package.json中针对生产构建的打包配置 "build": { "appId": "com.app.prototype", "productName": "Pluto", "copyright": "Copyright © 2018 Simon Inc.", "mac": { "target": [ "zip" ]

我正在使用electron v6.0.9和electron builder v21.2.0。以下是我的
package.json
中针对生产构建的打包配置

"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
    }
  },
我将构建脚本配置为
“pack”:“electron builder--dir-mwl”,在
脚本中
。问题是,当我运行命令
npm run pack
时,它会为所有平台打包应用程序,但对于windows,没有单个安装程序文件
.exe
或.msi”<代码>electron builder
为windows构建一系列文件


我正在运行macOS High Sierra v10.13.6(17G8030)。我也尝试在Windows10系统上构建,但结果是一样的。是否有任何配置错误,或者需要更多步骤来生成windows的单个安装程序文件

我想出了如何从electron source构建一个独立的安装程序,而不是一堆文件。实际上,我们必须将
electron-builder
-p
一起使用。 下面是my package.json文件中的构建配置

“构建”:{
“appId”:“com.trinityinfosystem.accurate”,
“产品名称”:“准确”,
“版权”:“版权所有©2018 Trinity信息系统”,
“mac”:{
“目标”:[
“拉链”
],
“发布”:[
“github”
]
},
“赢”:{
“publisherName”:“Trinity信息系统”,
“发布”:[
“github”
],
“目标”:[
“国家统计局”
]
},
“linux”:{
“目标”:[
“AppImage”,
“tar.gz”
]
},
“dmg”:{
“icon”:“build/icon.icns”
},
“发布”:[
{
“提供者”:“github”,
“所有者”:“vkiranmaniya”,
“回购”:“准确”,
“vPrefixedTagName”:true,
“私人”:没错,
“发布类型”:“草稿”
}
]
}
然后我使用了
electron builder-p never--win
,它将.exe文件打包到project\u root/dist目录中。如果您正在使用来自
electron builder
自动更新程序
,并且希望在github存储库中发布发布草稿,则可以始终使用
-p

如果要覆盖默认安装位置并让用户选择,请确保已按如下所示配置了
nsis
构建

“nsis”:{
“一键点击”:错误,
“perMachine”:错误,
“allowToChangeInstallationDirectory”:true
},

您在哪里定义了用于Windows的方法?是指其
nsis
appX
squirrel.windows
查看上面的我的
package.json
。我的目标是nsis,zipi发现它
“nsis”:{“oneClick”:false}
,但是,尽管这会创建安装弹出窗口,但它不允许用户选择哪个窗口?--不管怎样,它就在下面:D很抱歉MSG的垃圾邮件尝试在
nsis
build configits中添加
“allowToChangeInstallationDirectory”:true
,因为
“allowToChangeInstallationDirectory”
默认为
false
。我想我必须实现这一点