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
Breaking change in electron-updater 4.3.10 #6000
Breaking change in electron-updater 4.3.10 #6000
Comments
I got the same problem |
This has halted all development on our apps |
Same here |
。。。I solved this problem by specifying the version in package.json |
That would be a temporary fix. |
Yes, I also use Electron.NET, this problem has troubled me for a long time, I directly modified the CLI |
Nice. I have put a PR in to upgrade us to Electron 12.0.12 and Tweeted Gregor. No PR's since Jan makes for a sad dev team. |
Most electron builder users won't be aware of this issue before they publish a new release of their app. For this reason, it's best to fix this in a patch release. |
Also got this surprise today. Built and deployed updates refused to start on many user machines.. :( Please help. We use Electron .NET as well. |
@davej: I'm publishing a temp nuget package with the fixes your PR (and including also the fix for the splashscreen that has been long pending). It's based on my fork here: https://github.com/theolivenbaum/Electron.NET If you want to use it, you'll need to:
As this is now using Electron12, you also need to add this to your Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions
{
// ...
WebPreferences = new WebPreferences()
{
NodeIntegration = true,
ContextIsolation = false
},
// ... We're using this one till it's fixed upstream, and testing if everything still works. If you want to use it for now and hit anything, drop me an email to |
we need to use nodejs 12 for windows server 2003. is there a solution that works with nodejs12? |
|
hello, which version can I rollback to differential download? |
electronize build works using nodejs14 and with 4.3.9 set to the latest we're up and running again on win server 2003 |
Cheers for that. |
For a quick workaround, you can patch (using patch-package npm if you want to persist through commits) the AppUpdater.js file (located in node_modules/electron-updater/out/AppUpdater.js): diff --git a/node_modules/electron-updater/out/AppUpdater.js b/node_modules/electron-updater/out/AppUpdater.js
index 42ed9a3..469fa39 100644
--- a/node_modules/electron-updater/out/AppUpdater.js
+++ b/node_modules/electron-updater/out/AppUpdater.js
@@ -5,7 +5,6 @@ const builder_util_runtime_1 = require("builder-util-runtime");
const crypto_1 = require("crypto");
const events_1 = require("events");
const fs_extra_1 = require("fs-extra");
-const promises_1 = require("fs/promises");
const js_yaml_1 = require("js-yaml");
const lazy_val_1 = require("lazy-val");
const path = require("path");
@@ -377,7 +376,7 @@ class AppUpdater extends events_1.EventEmitter {
if (this._appUpdateConfigPath == null) {
this._appUpdateConfigPath = this.app.appUpdateConfigPath;
}
- return js_yaml_1.load(await promises_1.readFile(this._appUpdateConfigPath, "utf-8"));
+ return js_yaml_1.load(await fs_extra_1.readFile(this._appUpdateConfigPath, "utf-8"));
}
computeRequestHeaders(provider) {
const fileExtraDownloadHeaders = provider.fileExtraDownloadHeaders;
@@ -395,7 +394,7 @@ class AppUpdater extends events_1.EventEmitter {
async getOrCreateStagingUserId() {
const file = path.join(this.app.userDataPath, ".updaterId");
try {
- const id = await promises_1.readFile(file, "utf-8");
+ const id = await fs_extra_1.readFile(file, "utf-8");
if (builder_util_runtime_1.UUID.check(id)) {
return id;
}
@@ -477,7 +476,7 @@ class AppUpdater extends events_1.EventEmitter {
}
const downloadedUpdateHelper = await this.getOrCreateDownloadHelper();
const cacheDir = downloadedUpdateHelper.cacheDirForPendingUpdate;
- await promises_1.mkdir(cacheDir, { recursive: true });
+ await fs_extra_1.mkdir(cacheDir, { recursive: true });
const updateFileName = getCacheUpdateFileName();
let updateFile = path.join(cacheDir, updateFileName);
const packageFile = packageInfo == null ? null : path.join(cacheDir, `package-${version}${path.extname(packageInfo.path) || ".7z"}`);
@@ -499,14 +498,14 @@ class AppUpdater extends events_1.EventEmitter {
await downloadedUpdateHelper.clear().catch(() => {
// ignore
});
- return await promises_1.unlink(updateFile).catch(() => {
+ return await fs_extra_1.unlink(updateFile).catch(() => {
// ignore
});
};
const tempUpdateFile = await DownloadedUpdateHelper_1.createTempUpdateFile(`temp-${updateFileName}`, cacheDir, log);
try {
await taskOptions.task(tempUpdateFile, downloadOptions, packageFile, removeFileIfAny);
- await promises_1.rename(tempUpdateFile, updateFile);
+ await fs_extra_1.rename(tempUpdateFile, updateFile);
}
catch (e) {
await removeFileIfAny(); This worked for me. Hope it helps. |
Thanks, @Mgonand. You can probably also just do a 1-line diff. -const promises_1 = require("fs/promises");
+const promises_1 = require("fs").promises; |
You're right, that's better. I did the patch quick and didn't realize it. Thanks. |
we need to upgrade the old version to electrion@^13 |
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Yes, I think this issue is still relevant. I'm using electron-updater 4.3.9. Differential downloads don't work. Apparently they're fixed in 4.3.10, but that version won't work in Electron 10, which I have to use. I'm going to try the patch-package thing but it would be good to release a 4.3.11 that fixes the breaking change in 4.3.10. |
If I'm understanding this correctly, it seems we need to support node 14 (electron 12) and node 12 (electron 10). I wonder if we could use something like this for importing? Not at my dev machine to check
|
@mmaietta I ran your try/catch code and it worked fine. Seems a good solution. |
…ctron that use node 12 and below. Fixes: electron-userland#6000 Regenerating docs addition from PR electron-userland#6585
I noticed that
I'm working on getting this issue resolved so that you all are able to update your electron-updater to the newest alpha v5. |
* Replacing fs/promises with fs-extra to support legacy versions of electron that use node 12 and below. Fixes: #6000
Migrated commands to use fs-extra and released this in |
Electron-updater has introduced
fs/promises
which will break the build on Electron 11 and earlier. This is becausefs/promises
is not supported in Node 12 (which is used by Electron 11). The change was introduced in this PR: #5890This is a critical issue for anybody on Electron 11 or earlier because it will break their application after an update and it is not possible to recover by pushing a fix in an update.
The best mitigation that I think of here is to publish a
4.3.11
that does not usefs/promises
. If you want to usefs/promises
then you can publish5.0.0
that usesfs/promises
.The text was updated successfully, but these errors were encountered: