Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Electron create MSI installer using electron-builder

I managed to create an .exe installer for windows using electron builder, I create 2 package.json as pointed out in the docs :

https://github.com/electron-userland/electron-builder.

I ended up having a folder with a working .exe enter image description here

"dist:win64": "./node_modules/.bin/build --platform win32 --arch x64"

The build section of my main package.json is

"build": {
    "app-bundle-id": "org.test.mytest",
    "app-category-type": "public.app-category.graphics-design",
    "osx": {
      "contents": [
        {
          "x": 410,
          "y": 150,
          "type": "link",
          "path": "/Applications"
        },
        {
          "x": 130,
          "y": 150,
          "type": "file"
        }
      ]
    },
    "win": {
      "title": "My awesome app",
      "version": "2.28.999.1",
      "noMsi": false,
      "authors": "Author"
    }
  }

Everything works fine, I have and .exe installer but no way to have an .msi installer that put the content in program files directory.

enter image description here

Instead I ended up with an installation in the C:\Users\UserHome\AppData\Local\electron folder with and installer like below.

enter image description here

Is there a way to have a real .msi installer using electron builder that put the content in the Program file folder. The only one project that worked is this one https://github.com/theodo/electron-boilerplate but it uses a former version of electron-builder.

In the electron doc setting the noMsi to false, should do the trick ...

Should Squirrel.Windows create an MSI installer?
like image 334
Aaleks Avatar asked Apr 04 '16 09:04

Aaleks


People also ask

How do you make electrons?

Electrons can be created through beta decay of radioactive isotopes and in high-energy collisions, for instance when cosmic rays enter the atmosphere. The antiparticle of the electron is called the positron; it is identical to the electron except that it carries electrical charge of the opposite sign.


3 Answers

You don't actually need an MSI installed to get your app installed into Program Files.

If you disable one click in the nsis config (oneClick), the user is prompted whether to do the single user install (in AppData) or per machine (in Program Files).

If you don't want to give them the choice, you can set perMachine to false which will only allow install into Program Files:

"nsis": {
  "oneClick": false,
  "perMachine": false
},

I would personally leave them the option as they can still install without admin rights!

In the latest version of electron-builder there is also a allowToChangeInstallationDirectory option which allows the user to choose any install location.

like image 69
Tim Avatar answered Sep 23 '22 13:09

Tim


as stated in the wiki of latest electron builder release you have to use the msi option within build.win:

"build": {
    "app-bundle-id": "org.test.mytest",
    "app-category-type": "public.app-category.graphics-design",
    ...
    ,
    "win": {
      "title": "My awesome app",
      "version": "2.28.999.1",
      "msi": true,
      "authors": "Author"
    }
  }
like image 4
wilver Avatar answered Sep 26 '22 13:09

wilver


If all you want is an installer in exe format (I don't know about msi) you can use electron-builder to build the exe unpacked to a directory. Check out the documentation at http://npmjs.org/package/electron-builder. The documentation is pretty straight forward. After you obtain the unpacked folder with your exe , use "Inno Setup Compiler" to create a professional looking installer. Once you get the hang of it , it just takes like 5 minutes to do the whole thing.

like image 3
Shiva Teja Avatar answered Sep 24 '22 13:09

Shiva Teja