KansaiRobot
KansaiRobot

Reputation: 9912

How to use electron-builder with target portable?

I am trying to generate a exe file with electron-builder not an installer so I am trying by setting the target to portable

{
  "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"            
     }
     
    
  }
}

However when I try npm run dist I get

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

and the program is stuck for ever. When I break it(ctrl-c), it says

 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 .

So I guess the program is stuck in 7za compression.

I searched and there is no example of using electron-builder with portable only few with nsis. (I have another question but first I would like to run the basics).

Upvotes: 1

Views: 7607

Answers (1)

Muhammad Usman
Muhammad Usman

Reputation: 88

use electron-builder from 1 then in package.json use in scripts:

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

Upvotes: 5

Related Questions