Search code examples
ionic-frameworkelectronelectron-builderelectron-packagercapacitor

Windows support for Electron application created via Capacitor


I have just started looking at Capacitor as a possible solution to package my hybrid apps in an electron shell. This is the first time I have used Electron, so really know very little about it's details.

I ran through the following steps..

1. Create new Ionic app
2. install capacitor as per doco
3. run   npx add electron
4. cd electron
5. npm i electron-packager -g
6. electron-packager . --platform=win32

I ended up with a subfolder electron\capacitor-app-win32-x64that contained an executable, which ran fine on both my dev machine (Windows 10 x64), and another Windows (Windows Server 2008 R2 Standard x64).

My ultimate target device is a specialised small ruggedised tablet, that runs Windows 7 Embedded 32 bit.

It does not run on this, I get The version of this file is not compatible with the version of Windows you're running. I am not even sure if the build app is managed or unmanaged (assuming unmanaged?)

So, I would like to know what is not compatible about the Windows machine. Initial questions are

  1. How do I Know what "bitness" the Electron app is (ie 32 bit, 64 bit, or is it .net to is like "any cpu"). I can't see where to find out this information (dotpeek won't open the exe, and opening the exe in Visual Studio, I don't see much information)

  2. Could it be it is not build for the correct CPU?

  3. Is there some other dependency that perhaps the embedded Windows 7 has not got

Any help is how to figure this out would be great!

[UPDATE1]

Following some advice as given here, it appears it is a 64 bit application, which is strange as the command electron-packager . --platform=win32 appear to indicate we want a 32 bit. So that may be my problem.

Does anyone know how to make it build to 32bit?


Solution

  • Found the problem. Just need to add a --arch=ia32 to get 32 bit.

    So my complete build command was

    electron-packager . --platform=win32 --arch=ia32

    and it is now 32 bit and runs on the 32 bit machine.