We noticed that auto-update doesn't work on our newly released app. In our entry point we have:
import { autoUpdater } from "electron-updater";
// ...
autoUpdater.setFeedURL({
provider: "github",
owner: "org",
repo: "repo",
});
package.json
GH_TOKEN
latest.yml
fileWe don't have logs about what the actual error might be. We did many tests before and after with the same and similar setups and it seems to work for the most part (even without publish config). Nevertheless, we managed to probably reproduce the issue by setting up dummy projects in the same environment and we got:
An update is available.
Error in auto-updater. Error: ENOENT: no such file or directory, open 'C:\Users\xyz\AppData\Local\Programs\electron-updater-example\resources\app-update.yml'
The main difference being the environment, and in this particular environment if the publish
config is initially unset, app-update.yml
was not found in the installed app. Most interestingly, after removing the publish config app-update.yml
is still there.
To reproduce:
app-update.yml
is missing(build repo at 3.0.0: https://gitlab.com/gomori.zsolt1995/electron-updater-test-project/tree/f66d0bcd5b8912d3a9aa436cc74c4e546fe1bba4)app-update.yml
is present (build repo at 3.0.1: https://gitlab.com/gomori.zsolt1995/electron-updater-test-project/tree/c0d81fd3f10512eff5bb88bb7ba2a0117bc56ad3)app-update.yml
is present (build repo at 3.0.4: https://gitlab.com/gomori.zsolt1995/electron-updater-test-project/tree/522cd15f0dd110d62705b99c9e019723a13628d4)Found a few mentions about app-update.yml
not being found, most notably: https://github.com/electron-userland/electron-builder/issues/2736#issuecomment-456380922
But it's never clear anywhere whether this is a known bug or what's causing it and why this behavior seemingly isn't idempotent.
I'd like to understand how to fix it and whether we have any recourse for resurrecting auto-updates for existing users (in case there could be other reasons for this behavior).
In case it helps anyone, I ran into this issue when my package.json's build:win contained "target": [ "zip", "msi" ].
When I changed this to "nsis" instead of "msi" I found that app-update.yml started to be generated correctly. (Perhaps just try all three zip, msi, nsis if it's msi you're after...)
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.
Still relevant
I have the same problem.
- Version: ^22.2.0
- electron-updater Version: ^4.2.0
- target: win x64 portable
The autoupdater is created as const { autoUpdater } = require("electron-updater")
The application is packed with electron-builder -w --publish always
The relevant lines in package.json are
"build": {
"appId": "com.app.id",
"productName": "prodName",
"copyright": "Copyright 漏 2019 ${author}",
"win": {
"target": "portable",
"icon": "assets/icon4.png",
"publish": {
"provider": "generic",
"url": "http://updateurl.com/"
}
}
}
And the error I get in the log is
[2019-12-03 11:49:33.109] [info] Checking for update
[2019-12-03 11:49:33.209] [error] Error: Error: ENOENT: no such file or directory, open 'C:\Users\xyz\AppData\Local\Temp\1UTA56tjgEk9mjIZSBjQlkSgllh\resources\app-update.yml'
The .yml file and latest.yml are properly generated if I build with "nsis" target.
I ran into this problem when the publish
key is defined at the appImage
level and not at the linux
level. In that case, the app-update.yml file is not generated.
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.
Is this still relevant?
Very
Is there any progress on this? It's April 14, 2020, and, this issue is still not resolved. I tried to manually add my own app-update.yml file. But, doing so causes mac security to think the app was modified after being notarized.
Since there is no fix on this yet. I added "afterPack": "./afterPackHook.js",
in the build
part of package.json
. afterPackHook.js
file contains the code below. It generates the missing app-update.yml
, however, after the new version is downloaded I get an error.
Error after new version is downloaded
New version 1.3.2 has been downloaded to /Users/amichael/Library/Application Support/Caches/demoapp-updater/pending/Demo App-1.3.2-mac.zip
/ requested
/1587329652828-8531.zip requested
/1587329652828-8531.zip requested by Squirrel.Mac, pipe /Users/amichael/Library/Application Support/Caches/demoapp-updater/pending/Demo App-1.3.2-mac.zip
Error: Error: ENOENT: no such file or directory, rename '/Users/amichael/Library/Application Support/Caches/demoapp-updater/pending/temp-Demo App-1.3.2-mac.zip' -> '/Users/amichael/Library/Application Support/Caches/demoapp-updater/pending/Demo App-1.3.2-mac.zip'
afterPackHook.js
'use strict'
const fs = require('fs')
const path = require('path')
const yaml = require('js-yaml')
exports.default = async context => {
let data = {
provider: 'spaces',
name: 'demoapp',
region: 'nyc3',
path: '/test/'
}
switch (process.platform) {
case "win32":
data.updaterCacheDirName = 'demo-app-updater'
data.publisherName = ['Company Name LLC']
fs.writeFileSync(
path.join(__dirname, 'dist','win-unpacked','resources','app-update.yml')
, yaml.safeDump(data)
, 'utf8'
)
break
default: // unix
data.updaterCacheDirName = 'demoapp-updater'
fs.writeFileSync(
path.join(__dirname, 'dist','mac','Demo App.app','Contents','Resources','app-update.yml')
, yaml.safeDump(data)
, 'utf8'
)
break
}
fs.writeFileSync(
path.join(__dirname, 'dev-app-update.yml')
, yaml.safeDump(data)
, 'utf8'
)
}
This issue still exists on electron-builder@^22.6.0
, tested on Windows 10 Pro (latest) and Linux Mint 19.3. I tried everything, including using the not-recommended setFeedURL
, but nothing seems to work.
Every time user launches my app they see:
Unhandled Promise Rejection
Error: ENOENT: no such file or directory, open '/opt/APP_NAME/resources/app-update.yml'
I checked the folder and the only file there is app.asar
.
cc @develar
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.
Don't close this issue. This is an automatic message by Fresh - a bot against stale bots.
Hi, in case somebody has same issue (app-update.yml missing on Windows). Its generated only if one of the following targets is enabled: nsis or nsis-web. If you building only portable or zip + msi or any other combination of targets that doesn't include nsis - app-update.yml won't be generated as target is not "suitable" (source).
Also note, that this after pack handler that generates app-update.yml checks only build and platform publish
config - it won't generate config, if it set on target level on Windows/Mac.
And finally one more tip if you are building msi with auto-update: adding nsis target will trick builder to generate app-update.yml. But another important file that is required for updates elevate.exe is copied only as part of the following targets: nsis, nsis-web, portable, but not msi. Without this file when user will click install and restart application, it may crash with following error:
Its not reproducing every time, you might successfully build few releases and then following erorr might happen because msi and other targets are build in parallel. So, on one build msi might be slower and nsis or portable target will copy elevate.exe into pack folder, next time nsis might be slower and msi will end up without elevate.exe. Links to source: all targets build in parallel, copyElevateHelper registration
Any updates on this issue? This is still happening.
Any updates?
We are also facing the same
app-update.yml missing on Mac too if target: ["dir"]
Founded in docs
zip target for macOS is required for Squirrel.Mac, otherwise latest-mac.yml cannot be created, which causes autoUpdater error. Default target for macOS is dmg+zip, so there is no need to explicitly specify target.
The problem remains.
[2020-10-23 23:36:35.664] [error] Error: Error: ENOENT: no such file or directory, open 'C:UsersxxxAppDataLocalTemp1jHfEUq4XtWD9LmPfvcOFcWKQL2resourcesapp-update.yml'
Thank you @AndrewReisdorph this worked like a charm
I was having the same issue, even though my build was working fine. I found that I have to have nsis in lowercase, it was previously uppercase. After doing so the app-update.yml and resources folder were properly built. I don't know if this helps anyone but I thought I'd share.
"build": {
"appId": "APP NAME HERE",
"win": {
"target": "nsis"
},
Most helpful comment
This issue still exists on
electron-builder@^22.6.0
, tested on Windows 10 Pro (latest) and Linux Mint 19.3. I tried everything, including using the not-recommendedsetFeedURL
, but nothing seems to work.Every time user launches my app they see:
Unhandled Promise Rejection Error: ENOENT: no such file or directory, open '/opt/APP_NAME/resources/app-update.yml'
I checked the folder and the only file there is
app.asar
.cc @develar