How to pack installable files with electron

my app is running fully offline and uses local database (Mongodb) to store data. A feature of the app is when users start using it they have the databse installation file packed with electron package so the app can detect it and install the database automatically…
I used
1- electron-react-boilerplate
2- target system is windows machines
3- database is mongodb enterprise
i was able to install the app and locate the mongodb.msi installation file but when installation process starts it hangs after a few seconds
the question is… it is easy to provide the mongodb.msi installation file for the users and prompt them to install it first before installing the app!! but is there a gentel way to do this automaticaly-that is install required dependencies without asking the user to do anything by their own ??

I don’t use Windows too often (I have Window 10 on internal drive and Ubuntu on separate drive - Ubuntu is much faster) and when just now I dived into Windows to test mongoDB installation I encountered the usual Windows prompts to pay for various services such as virus scanning etc. Then the lengthy upgrades as I restarted to get back into Ubuntu.

That apart … I wonder if you have encountered this documented issue

My approach in similar setups is to call an external helper script which installs required applications and configures them (similar to apm in Atom). This would keep your Electron dashboard app quite separate from the loader app. You can research automation scripts which take over control of the desktop in “autopilot” mode. In Windows there is AutoHotKey but I am looking at cross platform scripting tools which work across Ubuntu or Windows

1 Like


well to be honest i am a frontend dev with minimum os skills (windows). however my intuitive intention was to automate intsallation regardless of the operating system… and here is what happend:
1- my app is using Mongodb Enterprise edition to store data
2- i packed mogodb.msi installer file with my electron installation package
3- i used nodejs child_process functions(exec(), execSync()…etc) to look for the “.msi” installation file and execute it
4- i used msiexec.exe command to start the installation process (since i am workin on windows and my tearget os is always windows)
What really happend is windows “msiexec.exe” was very confusing (although docs are clear). after many tries and cries (coffe and chai cups) i had to do this:
1- init the installation for the mongodb.msi
2- let the user finish the installation (2 to 3 clicks)…
3- i lost the advantage of keeping everything autumated under the hood however acheived the goal of delivering installable files and execute them.

So as a guide for other developers on how to add installable files here is what i did:

  1. I used electron-react-boilerplate to build my App Electron-react-boilerplate
  2. I used Monogdb Enterprise .msi installer to install database localy. install mongodb with windows terminal
    3.I used webpack copy plugin Copy-webpack-plugin

1- ask builder (electron-react-boilerplate) to take a copy of the installable file “anyInstallableFile.msi” and send it to the final packed (ready to distribute for users) folder of my electron App.


const CopyPlugin = require('copy-webpack-plugin');
new CopyPlugin({
  patterns: [
       from: path.resolve('your source'),
       to: path.resolve('to your destination'),

2-now that i have the file, when app runs say, for the very first time and it realize that it has to istall any dependecies (our database in this case) then define something like:


async function installDependency() {
      const FIND_MSI_FILE = 'dir mongodb.msi /s /b';
      const { stdout } = await exec(FIND_MSI_FILE, { cwd: '/' });
      const data = stdout.toString();
      await exec(`msiexec.exe /qf /i mongodb.msi`, {cwd: path.dirname(data.replace(/\r\n/g, '')),});

first line is a command used in windows to get path of a specific file name,
second line is using nodejs exec asynchronus function to execute that command [see nodejs child_process to learn more about shell and comamnds automation]. third line is simply a strin representation of retrieved data from the line above it. last line is another use nodejs exec function that will execute the msiexec.exe command See it HERE.

this way i was able to deliver my app , let the user install it and the app will handle installing any missing dependency on user’s machine

1 Like

Good explanation of a complex subject. I would also consider how to add into this release some tutorials for new users. An eLearning add on. I use markdown in Atom previewed through markdown-preview-enhanced to create reveal.js presentations to embed as HTML in Electron app.

1 Like

cool :rocket:
i really need to dig deeper into that… seems a lot more intutive to pack along with my App rather than like having a ststic website where they can refer to for guides and FAQs