Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to use local electron binaries #187

Closed
romaincointepas opened this issue Nov 9, 2015 · 38 comments · Fixed by #1094
Closed

Add an option to use local electron binaries #187

romaincointepas opened this issue Nov 9, 2015 · 38 comments · Fixed by #1094
Labels
enhancement Feature request

Comments

@romaincointepas
Copy link

Right now electron-packager can only be used with official releases (dowloaded with electron-download). I would be interested in using it with locally built binaries (instead of specifying version, we would specify binary-path?).

@romaincointepas romaincointepas changed the title Add an option to local electron binary path Add an option to use local electron binaries Nov 9, 2015
@malept malept added enhancement Feature request help wanted Needs a contributor from the community labels Nov 9, 2015
@Silvercast
Copy link

+1
I know we can use cache option but maybe it's better to have ability to specify where to download electron files

@malept
Copy link
Member

malept commented Apr 10, 2016

If you run your own local mirror (via a simple file-serving HTTP server), electron-download provides a way to do this via environment variables.

Apart from that, I'm not sure what the advantage of not using the cache parameter is.

@ghost
Copy link

ghost commented Aug 25, 2016

You can copy the binary file to /home/user/.electron and electron-packager will use that file, as long as it's the latest version. I assume you can direct it to use an older cached file if you specify the version and it finds that version in the cache directory (/home/user/.electron)

It's the default behavior of electron-download. You'll notice once you download, it will use the .zip in /home/user/.electron afterwards as it stores it there

I had same concern so I could work/build offline.

You can get latest builds from: https://github.com/electron/electron/releases
Info for electron-download, used by electron-packager, here: https://www.npmjs.com/package/electron-download

@malept
Copy link
Member

malept commented Aug 25, 2016

FYI, you can download via the electron-download CLI instead of downloading manually via the releases page.

@craxal
Copy link

craxal commented Nov 17, 2016

What if I don't want to use one of the official releases? What if you want to use your own build of Electron? electron-packager (or perhaps electron-download) doesn't appear to handle this at all. I've tried putting a prebuilt package in various places mentioned above (which won't work in distributed build systems) and setting the cache option, but it always hits the electron repository and ignores my local package.

@develar

This comment has been minimized.

@malept
Copy link
Member

malept commented Nov 17, 2016

@craxal it should work if you pin your Electron version to an exact version (that already exists) and create one or more zip files (depending on which targets you're packaging for) that are formatted and named the same as the official releases. I just tried it with electron-quick-start, with a zipped electron file named electron-v1.2.0-linux-x64.zip and using Electron Packager with a custom download.cache directory I specified with said custom zip ran without errors. You may be interested in a similar issue in electron-prebuilt: electron-userland/electron-prebuilt#192

@craxal
Copy link

craxal commented Nov 17, 2016

@develar I looked into it, but the macOS only caveat is a serious deterrent.

@malept How can I tell if electron-packager is in fact using my local .zip (which is, in fact, named exactly the way an official Electron package is named)?

@malept
Copy link
Member

malept commented Nov 17, 2016

@craxal Run Electron Packager with DEBUG=electron-download. One of the debug lines is "zip exists" with the full path to the cached zip file, if it uses a cached zip file.

@malept
Copy link
Member

malept commented Nov 17, 2016

@craxal Set process.env.DEBUG = 'electron-download' before you require('electron-packager'), I think. This seems related: debug-js/debug#275

@craxal
Copy link

craxal commented Nov 17, 2016

@malept OK, it seems to work for a Linux machine, at least. It can see the .zip, and I saw no download progress bar.

@craxal
Copy link

craxal commented Jun 13, 2017

I need to revisit this issue. There must have been some significant changes between 8.5.1 and 8.7.1, because my builds are now failing checksums against custom Electron builds.

Tue, 13 Jun 2017 22:34:07 GMT electron-download info { cache: 'E:\\A',
  filename: 'electron-v1.7.2-win32-ia32.zip',
  url: 'https://github.com/electron/electron/releases/download/v1.7.2/electron-v1.7.2-win32-ia32.zip' }
Tue, 13 Jun 2017 22:34:07 GMT electron-download zip exists E:\A\electron-v1.7.2-win32-ia32.zip
Tue, 13 Jun 2017 22:34:07 GMT electron-download Verifying zip with checksum
E:\A\_work\8\s\src\Standalone\gulp\gulpfile.package.js:222
            throw (err);
            ^

Error: Generated checksum for "electron-v1.7.2-win32-ia32.zip" did not match expected checksum.

By the way, I'm now using a custom build based on Electron 1.7.2, which I think is still in beta.

Also, electron-packager also appears to be obliterating my local cached copy of the package after it fails the checksum. In it's place, there's a SHASUMS256.txt-1.7.2 file.

@malept
Copy link
Member

malept commented Jun 13, 2017

I don't think there are any download-specific changes between 8.5.1 and 8.7.1, you can check the NEWS file.

You need to set the checksum file as well in the cache directory, though.

@craxal
Copy link

craxal commented Jun 13, 2017

Yeah, just tried it again with 8.5.1, and I still have the same problem.

How do I set the cache file location? I don't see any documentation on how to do that. Also, I don't have a checksum file for 1.7.2. I assume that if the checksum file isn't specified, electron-download tries to pull it from the publicly available one with the matching version. Since this Electron version isn't out yet, I'd rather skip the checksum step.

Either way, this should not be deleting my cache if the checksum fails! This sounds like a very bad bug to me.

@malept
Copy link
Member

malept commented Jun 13, 2017

It's by design. It assumes that if the checksum doesn't match, the download is corrupt and should be deleted so that it can be re-downloaded.

Perhaps what should happen is that someone should provide a pull request to completely bypass electron-download, but in that case you would only be able to package one platform/arch at one time, so it may be a bit too complex to be added.

@craxal
Copy link

craxal commented Jun 14, 2017

That would be ok if electron-download was actually downloading something. In this case, I'm just telling it to look somewhere. It shouldn't delete things from someone's machine that it didn't put there on its own.

It seems electron-packager is not well suited for custom Electron builds, which is something a lot of teams require. Since this sounds like a different issue than the one listed here, should I open a new issue?

@malept
Copy link
Member

malept commented Jun 14, 2017

Electron Packager works better when a team provides a download mirror that "looks" like the official Electron download location (i.e., zipped binaries plus checksum files) instead of trying to pre-seed a cache without checksum files.

I'm not saying that I won't accept a change to allow local electron binaries (which is why this issue isn't closed), but I haven't seen a good proposal for it that doesn't require a lot of complexity to be added to Electron Packager (nor have I come up with one yet).

@develar

This comment has been minimized.

@craxal
Copy link

craxal commented Jun 15, 2017

@malept Sorry, not to sound picky, but if cache is set, I'd rather electron-packager not default to downloading from the default URL.

@develar Something to consider, but not an option for us at the moment.

@malept
Copy link
Member

malept commented Jun 15, 2017

@craxal a "cache-only" feature sounds like what you want, but it's more of a feature request for electron-download, because that handles cache management.

@javaxiu
Copy link

javaxiu commented Sep 27, 2019

so how is this 'cache-only' feature now? wish to use a local electron version which is custom make

@malept malept removed the help wanted Needs a contributor from the community label Dec 18, 2019
@malept
Copy link
Member

malept commented Dec 18, 2019

I've decided to add an electronZipDir option. Adding a single option to specify a path to a ZIP file doesn't work when you're using Packager to build multiple platform/arch combinations at once.

@malept
Copy link
Member

malept commented Dec 18, 2019

The feature is in pull request #1094.

@FFY00
Copy link

FFY00 commented Dec 19, 2019

It does not fully fix this. That still requires a electron zip, we would like to use the local electron installed on the system.

@malept
Copy link
Member

malept commented Dec 19, 2019

we would like to use the local electron installed on the system.

The comment I raised earlier also applies to that:

Adding a single option to specify a path to a ZIP file doesn't work when you're using Packager to build multiple platform/arch combinations at once.

If you can build Electron from source, you should also be able to generate a ZIP file of the built files so you can use it with Packager. Another problem with the "locally built electron" proposal is the maintenance cost is pretty high for a feature that a very small percentage of users will use.

@FFY00
Copy link

FFY00 commented Dec 28, 2019

As I stated previously.

It does not fully fix this.

Another problem with the "locally built electron" proposal is the maintenance cost is pretty high for a feature that a very small percentage of users will use.

It is not something a lot of users will use, but it is something distributions will use.

@malept
Copy link
Member

malept commented Dec 28, 2019

Can you define what "distributions" are?

@FFY00
Copy link

FFY00 commented Dec 28, 2019

Can you define what "distributions" are?

Linux distributions. Archlinux, Gentoo, Ubuntu, Debian, etc.

@malept
Copy link
Member

malept commented Dec 28, 2019

Those that are Linux distribution package maintainers are unfortunately an extremely tiny percentage of consumers of this package. I maintain this package in my spare time, so I'm not currently willing to maintain a feature for so few users, especially if it depends on being able to have a source copy of Electron (& building it) available. I think that generating a zip file via the build scripts in the Electron repository is a reasonable tradeoff.

That being said, I have recently joined the GitHub Sponsors program, so I'm willing to maintain features that are needed by a smaller percentage of the userbase in return for monetary compensation.

Alternatively, I'm willing to accept a pull request for exactly what you're looking for (with the appropriate documentation & tests that it only works with one specific Electron platform/arch combination), on the condition that the person submitting the request is willing to maintain the feature.

blshkv pushed a commit to pentoo/pentoo-overlay that referenced this issue Mar 14, 2020
@blshkv
Copy link

blshkv commented Mar 14, 2020

@malept your last reason does not make much sense. You should work with Linux maintainers to push your package into each Linux distribution and ask users to run a standard command "<installer> install electron-packager".

it's better to deal with 10 linux distros maintainers (who know what they are doing) instead of zillions users (who should not install it without a packet manager (installer) anyway).

P.S. Thanks for the option. It's just a workaround but allowed me to fix a script.

@FFY00

This comment has been minimized.

@malept
Copy link
Member

malept commented Mar 14, 2020

@blshkv

You should work with Linux maintainers to push your package into each Linux distribution and ask users to run a standard command " install electron-packager".

To reiterate from my last comment, I maintain this package in my spare time. First, it's already in the npm registry, available to be installed via npm and yarn. Second, the idea of trying to add an electron-packager package to a Debian-based distribution is extremely daunting, given all of the dependencies (and I try to limit the number of dependencies). Electron Packager is meant to be installed in an Electron application as a devDependency and run as an npm script, although you are given the freedom to run it globally (either by npm install -g or npx, in the case of npm). Trying to get it into package managers is an implicit endorsement of the "install it globally" method, which has led to a lot of incorrect issues being opened, which I've been trying to avoid.

If electron-packager ends up being added as a package in a Linux distribution, great. But I'm not going to push for it.


I would like to remind folks that commenting about the current decisions about a "runtime mode" is off-topic for this issue and this repository. Please direct your (constructive) comments to the appropriate issue in the Electron issue tracker.


Finally, to reiterate another point in my last comment, so it's clear:

There's currently only one person actively working on features for this package: me, in my spare time. I personally work on adding features to this package that will benefit the most users, as that is the best use of my limited time. Most folks on Linux (I am one of them, and have been for 17 years - I was even a Gentoo user for about a decade) will download/install an Electron app from the app author. That being said, there are two options at this point:

  1. Sponsor me to write and maintain the feature you're asking for. This has actually happened before with the electron-installer-snap module that generates Linux distributables for Snap stores.
  2. Have either yourself or someone you've found to write and maintain the feature. Remember, Electron is a community-driven project, and this module is no exception. I do not want to have a feature in this module that will bitrot because it isn't maintained. I am more than happy to help someone get their change into this module if they'll help maintain their feature.

@FFY00
Copy link

FFY00 commented Mar 14, 2020

Most folks on Linux (I am one of them, and have been for 17 years - I was even a Gentoo user for about a decade) will download/install an Electron app from the app author.

That is just not true, but sure.

There's currently only one person actively working on features for this package: me, in my spare time.

You might want to move it out of the @electron namespace then.

@malept
Copy link
Member

malept commented Mar 14, 2020

That is just not true, but sure.

It is true, but that's mostly because many of the popular Electron apps are proprietary. This is why stores such as the Snap store & Flathub exist. Additionally, several distributions prohibit distributing binaries that weren't built by their own infrastructure, which is kind of the point of this issue anyway.

You might want to move it out of the @electron namespace then.

Features are primarily written by me, but maintenance is by the Ecosystem WG.

Your comments are on the verge of being unproductive, I would advise that you think carefully about any further responses.

@FFY00
Copy link

FFY00 commented Mar 14, 2020

It is true, but that's mostly because many of the popular Electron apps are proprietary. This is why stores such as the Snap store & Flathub exist. Additionally, several distributions prohibit distributing binaries that weren't built by their own infrastructure, which is kind of the point of this issue anyway.

I don't really have any data to back me up but from my experience, most users usually install distribution packages that just contain the prebuilt binaries provided by the upstream.

Features are primarily written by me, but maintenance is by the Ecosystem WG.

Okay then.

Your comments are on the verge of being unproductive, I would advise that you think carefully about any further responses.

What do I need to say for you to re-open the issue? Or do you want me to create another issue? I understand you don't want to work on it, but it is still a valid request.

I would love to be able to sponsor you, I would, but unfortunately I don't have the means. I think that making me feel invalidated because I don't sponsor you is not a correct position to have, especially in a upstream like electron.

Maybe this was just miscommunication but what I am trying to say is simply that I think my request is valid and, as such, this issue should not be closed.

@blshkv
Copy link

blshkv commented Mar 14, 2020

We all do what we do here (writing code and even report bugs) in spare time. We are in the same boat. @FFY00 i think the best option is to create a pull request at this point.

@FFY00
Copy link

FFY00 commented Apr 22, 2020

As I said above:

It does not fully fix this. That still requires a electron zip, we would like to use the local electron installed on the system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

13 participants