Packaging an electron app into .exe and adding Python installation


#1

I am developing an electron app. I would like to create a single executable file that would also install Python on the way. So far I managed to create a single .exe file using electron-packager and electron-squirrel-startup. I wanted to, using node-cmd, add a command to install Python, but it failed. My plan was to do something like this:

function handleSquirrelEvent(application) {  
const squirrelEvent = process.argv[1];
    switch (squirrelEvent) {
       case '--squirrel-install':
       case '--squirrel-updated':
          var cmd=require('node-cmd');
          cmd.run('msiexec /i "python-2.7.13.amd64.msi" /passive /norestart ADDLOCAL=ALL');
    }
};

But it doesn’t work - I suspect that you can only use update.exe supported commands in case '--squirrel-updated' section. Does anyone have a better idea how to achieve this goal? What comes to my mind now is to write a .bat script that would install Python first and then start the .exe file I managed to created, but maybe there’s a better way?


#2

Why it does not work?


#3

@azurinko I am not sure, I read this post:

https://stackoverflow.com/questions/30105150/handle-squirrels-event-on-an-electron-app

and in the comments someone says "I just invoked Update.exe from the command-line to see all the supported commands. " and I think that in case '--squirrel-updated' you can only use commands from there.