如何将电子生成器与目标便携式设备配合使用?

时间:2019-04-22 09:15:35

标签: electron electron-builder

我正在尝试使用electron-builder 不是安装程序生成exe文件,因此我正在尝试将目标设置为可移植

{
  "name": "hello-world",
  "version": "1.0.0",
  "description": "a hello world",
  "main": "index.js",
  "scripts": {
    "start": "electron .",
    "dist": "build"
  },
  "author": "KR",
  "license": "ISC",
  "devDependencies": {
    "electron": "^4.1.4",
    "electron-builder": "^20.39.0"
  },
  "build":{
     "appId": "com.whatever.helloworld",
     "win":{
        "target": ["portable"],
         "icon" :   "build/icon.ico"            
     }


  }
}

但是当我尝试npm run dist时,我会得到

Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
  • electron-builder version=20.39.0
  • loaded configuration file=package.json ("build" field)
  • writing effective config file=dist\builder-effective-config.yaml
  • no native production dependencies
  • packaging       platform=win32 arch=x64 electron=4.1.4 appOutDir=dist\win-unpacked
  • default Electron icon is used reason=application icon is not set
  • building        target=portable file=dist\hello-world 1.0.0.exe archs=x64

,该程序将永远被卡住。当我破坏它(ctrl-c)时,它说

 Error: Exit code: 255. Command failed: D:\electrontest\hello-world\node_modules\7zip-bin\win\x64\7za.exe a -bd -mx=9 -mtc=off -mtm=off -mta=off D:\electrontest\hello-world\dist\hello-world-1.0.0-x64.nsis.7z .

所以我想程序被卡在7za压缩中了。

我进行了搜索,但没有使用nsis携带便携式电子生成器的示例。我会在这里感谢您的帮助。 (我还有一个问题,但首先我想运行基本的)

1 个答案:

答案 0 :(得分:1)

使用1中的电子助洗剂 然后在package.json中使用脚本:

"dist": "electron-builder --win=portable",