1

I am new to Electron and love it. Just finished writing a wonderful little app for the entertainment industry and am having trouble packaging it. Also notice that there is an electron compiler and a packager. Which one do you use that is most convenient for a windows end user ? I work with mostly windows people in a certain segment of the entertainment biz, so being a Linux user you get tons of flack if something does not work. Here is the problem :

package.json:

{
  "name": "Sick Bay Scanner by H.A. Hobson",
  "productName": "SickBayScanner",
  "version": "1.0.1",
  "main": "main.js",
  "devDependencies": {
    "electron-winstaller": "^2.6.3"
  }

}

Packaging argument and outome :

me@debian:/$ electron-packager --electron-version=1.7.9 . sound/SickBayScanner --overwrite --asar=true --platform=win32 --arch=x64 --icon=assets/icons/png/1024x1024.png --prune=true --out=release-builds
WARNING: --asar does not take any arguments, it only has sub-properties (see --help)
Downloading tmp-6742-0-electron-v1.7.9-win32-x64.zip
[============================================>] 100.0% of 53.89 MB (421.05 kB/s)
Packaging app for platform win32 x64 using electron v1.7.9
EPERM: operation not permitted, open '/dev/core'

If you could explain how to create electron apps that are as easy possible for an end user to use, whether packaged or compiled, and point out my own packaging issue, would be very appreciative. Thanks !

Pritam Banerjee
  • 17,953
  • 10
  • 93
  • 108
hahobson
  • 37
  • 2
  • 10

2 Answers2

1

Is this everything included in your package.json? Do you have other dependencies?

If you do, please edit your question, this has been one of the reasons why I have seen this error in the past.

Make sure you install electron-builder and add something like this to you package.json:

"postinstall": "npm install --save electron-builder && npm install --save [any other dependency you didn't mention] && install-app-deps"

this will ensure you properly install these dependencies for the system you intend to use the app on.

I recommend using electron-packager as it will automatically detect the system for you.

Edit:

okay, you won't need install-app-deps since you don't have any major dependencies that need to be built from source to target windows env, as you mentioned in your comment below. So you just need to install wine. Problem is, i don't think there's a workaround installing it globally on the machine you will be use to package your app. Here's the closest solution i found: https://github.com/rahatarmanahmed/electron-packager-dummy-wine I haven't tested it and please note the readme mentions there are caveats :("

Community
  • 1
  • 1
LSTM
  • 128
  • 8
  • Thanks for your comment. The only thing I have is a small .wav file called in JavaScript, otherwise it is just a few .png files called in HTML. I will try adding what you wrote above. – hahobson Nov 15 '17 at 03:31
  • I added electron-packager using yarn, and it loaded effortlessly. I then got this: harry@debian:/usr/lib/node_modules$ electron-packager --electron-version=1.7.9 . /home/harry/sound/SickBayScanner --overwrite --platform=win32 --arch=x64 --DEBUG=* --icon=assets/icons/png/1024x1024.png --prune=true --out=release-builds – hahobson Nov 15 '17 at 08:00
  • Packaging app for platform win32 x64 using electron v1.7.9 Could not find "wine" on your system. Wine is required to use the appCopyright, appVersion, buildVersion, icon, and win32metadata parameters for Windows targets. Make sure that the "wine" executable is in your PATH. See https://github.com/electron-userland/electron-packager#building-windows-apps-from-non-windows-platforms for details. – hahobson Nov 15 '17 at 08:00
  • The script you provided is below: { "name": "Sick Bay Scanner by H.A. Hobson", "productName": "SickBayScanner", "version": "1.0.1", "main": "main.js", "postinstall": "npm install --save electron-builder && npm install --save [any other dependency you didn't mention] && install-app-deps" "devDependencies": { "electron-winstaller": "^2.6.3" } "scripts": { "pack": "electron-builder --dir", "dist": "electron-builder" } } – hahobson Nov 15 '17 at 08:06
  • Do you need Wine to do the packaging ? It seems sort of logical. Any pointers as to how to include wine in the argument ? – hahobson Nov 15 '17 at 08:08
0

Firstly I've had a lot of trouble packaging windows on linux so in the end I just made a virtual windows machine using virtual box and did it there. The only problem is it's tricky to get the right iso :(

Secondly I don't think there is much of an advantage to using asar because there are not many people who want to look at your source code and the ones who do mostly know how to unpack asar and get to your source code.

https://stackoverflow.com/a/38524534/6577664

All in all I think your best option is just to do it on a windows PC.

Joshua
  • 5,032
  • 2
  • 29
  • 45
  • Thanks Mike. Just been Windows free for over 10 years now. Was just hoping to remain so. I will try to find a spare machine just for microsoft customers at some point. – hahobson Nov 15 '17 at 03:34
  • harry@debian:/usr/lib/node_modules$ electron-packager --electron-version=1.7.9 . /home/harry/sound/SickBayScanner --overwrite --platform=linux --arch=x64 --DEBUG=* --icon=assets/icons/png/1024x1024.png --prune=true --out=release-builds Packaging app for platform linux x64 using electron v1.7.9 Wrote new app to release-builds/-home-harry-sound-SickBayScanner-linux-x64 Is this what a successful Linux build looks like ? Even though I deal with Windows people, they would have little qualms about using a Raspberry Pi for production so long as they do not have to service it. – hahobson Nov 15 '17 at 09:12
  • Yes that is what a successful linux build would look like – Joshua Nov 15 '17 at 14:23