This is in relation to the recently-fixed https://github.com/electron-userland/electron-builder/issues/1254
Now, running autoUpdater
using electron path/to/app
results in
autoUpdater { Error: ENOENT, dev-app-update.yml not found in /.../node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar
Is there something I should be doing to generate this file?
If you want to use updater in a dev mode, you need to add this file manually.
Please specify electron version.
electron version 1.6.6
Is there a template of what this file should contain? Not even sure where to find the generated app-update.yml..
@develar I'm not sure where to manually add this file either...
default_app.asar
is in a binary format so I can't amend anything inside of it
@zeevl I believe the generated file is ./dist/win-unpacked/resources/app-update.yml
for Windows, or ./dist/mac/MyApp.app/Contents/Resources/app-update.yml
for macOS. You can copy it to app/dev-app-update.yml
.
@sebn Is this where you mean?
As this doesn't seem to work.
I could add it manually to ./dist/mac/MyApp.app/Contents/Resources/app-update.yml
but that directory ./dist/mac/
gets emptied and re-generated with every build so this would only work for 1 release cycle and I'd have to repeat the action every time?
@alexcroox Maybe you're confusing development and production setup?
Yer I'm still confused unfortunately. I'm running webpack-dev-server --hot --colors --config webpack.renderer.config.js --port ${config.port} --content-base app/dist
The error I'm getting is Error: ENOENT, dev-app-update.yml not found in /Users/alex/Projects/xxxx/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar
.
I'm still not sure where to manually copy dev-app-update.yml
. I've added it to:
/Users/alex/Projects/xxxx/node_modules/electron/dist/Electron.app/Contents/Resources
/Users/alex/Projects/xxxx/dist/mac/xxxxx.app/Contents/Resources
Still the same error
dev-app-update.yml
is only and only for testing during development and unpacked. And it is advanced feature. Consider to test using packed app.
The work around for development for me is now
if (process.env.NODE_ENV === 'development')
// Skip autoupdate check
else
autoUpdater.checkForUpdates()
https://github.com/sindresorhus/electron-is-dev recommended.
@develar Mate...
The issue is you have a hard-wired check for dev-app-update.yml, already using the electron-is-dev module.
It is in AppUpdater.js:loadUpdateConfig()
It is using electron app.getAppPath() when dev mode is detected, which is generally going to point to default_app.asar when running 'electron' for dev.
This makes no sense as it can't be implemented as we can't place a file there.
So why have the code?
You are awesome for making electron-builder/electron-updater, but I find a lot of your dev decisions very baffling and frustrating when encountered, unlike any other popular open source package I've used.
Perhaps you should consider asking a couple of people to join a committee who bring a different perspective? Happy to help, I have 20+ years of SD experience, a lot of architecture.
This referenced issue is breaking even production builds because I have 'electron' in my dev path which causes electron-is-dev to return true when it shouldn't.
You should not use electron updater in the dev mode.
That makes it incredibly hard to develop an updating system/UI if you have to build every time you change a line of code relating to the update system UX in order to test the result...
I can understand it not being supported in dev mode, the update system must rely on an install having files in certain places.
@alexcroox Please note โ not "must", but "should". Want to test โ no problem. Just create dev-app-update.yml
with your own configuration to test :)
@TimNZ On macOS your update will be successful only if app is signed, but place doesn't matter (so you can run it not only from /Applicaitons, but from dist folder also). So, no way to test update fully, but you can test "update system UX" using dev-app-update.yml
.
To make clear โ we are not going to improve this aspect without properly formulated issue request. (Hint: JetBrains IDEs allows you to debug packed applications, even in the asar, in the same way as you debug your dev build). dev-app-update.yml
is not created for you, it is your responsibility to create it according to your needs. If you think that it will be cool if electron-builder will have special command to generate such file or even somehow grab configuration on the fly from your electron-builder configuration โ please file issue (and if you are commercial company โ you can even donate to make sure that feature will be implemented in a short term).
@alexcroox If your issue is that dev file is not located correctly (The error I'm getting is Error: ENOENT, dev-app-update.yml not found in /Users/alex/Projects/xxxx/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar.), I will check it now.
@develar yer I added it to those 2 locations above but was still getting the error not found. Ran out of places to find that I might be able to place it
Maybe this will help someone for solving this issue. For me it worked creating the dev-app-update.yml
manually in the top level of my electron app. I am using the two package.json way.
My directory structure then looks like this
.
โโโ app
โ โโโ main
โ โ โโโ main.js
โ โ โโโ update.js
โ โโโ package.json
โ โโโ renderer
โ โ โโโ ...
โ โ โโโ main.jsx
โ โโโ yarn.lock
โโโ dev-app-update.yml
โโโ package.json
โโโ publish.sh
โโโ yarn.lock
And in dev-app-update.yml
I inserted the following for using GitHub:
owner: yourGHName
repo: yourGHRepoName
provider: github
And then normally start your main entry file with electron main.js
.
Hi, is the path issue fixed? for me dev-app-update.yml
is still expecting to be at ...Contents/Resources/default_app.asar
location which is invalid.
for me workaround for now:
if (isDev) {
autoUpdater.updateConfigPath = path.join(__dirname, 'app-update.yml');
}
quick question, what is the format of the dev-app-update.yml
file?
@ysfjwd
In case you want to use GitHub as your "Update Server" the following format should work
owner: yourGitHubName
repo: yourRepositoryName
provider: github
At least this is what is working for me
@alexanderwe Hi
I did as you said. But, Get the following tips.
[11:11:37.156] [info] Checking for update
[11:11:37.156] [info] Checking for update...
[11:11:37.297] [info] Generated new staging user ID: xxx-xxx-xxxx
[11:11:37.348] [info] Update for version 1.6.2 is not available (latest version: 1.0.2, downgrade is disallowed.
[11:11:37.349] [info] Update not available.
@zhanyouwei
Did you made a release for the new version on your GitHub repo ?
I get this on windows
ENOENT, dev-app-update.yml not found in [path]\node_modules\electron\dist\resources\default_app.asar
Update:
autoUpdater.updateConfigPath = path.join(_path to app-update.yml_);
solved my issue.
When I run this locally with the fix above, it compares the latest release of my app to the version of electron rather than the app itself.
Anyone manage to get this working with Amazon S3? I've burned half a day on this seemingly simple task.
I get null
as my result every time without fail in development.
I can't even understand where the autoUpdater
is supposed to be checking for the yml
file and whether it's doing that and failing to find it, if the configuration is wrong, etc. This is a complete black box besides digging through the source code yourself to understand what's going on.
I understand it's recommended to test this in a packaged app, but that's not really feasible in every situation. I've tried setting the updateConfigPath and a every other tip I've found online and in this thread, and always null
, every single time, with no errors or warnings regarding dev-app-update.yaml
All I'm trying to do with this right now is to get info about the latest update to show in the GUI =(
Hope this saves somebody a day.
In development
env, DO NOT USE checkForUpdatesAndNotify()
- You MUST USE checkForUpdates()
This little oversight cost me big time. I expected it would still check for updates, but it doesn't seem to from what I can tell.
I assume this is because this isn't _really_ a supported feature, there's no provided partial functionality for that function in development, seems to be the case. The promise always resolves with null
from what I can tell.
All credit to @yeongjet - https://github.com/electron-userland/electron-builder/issues/3753
Creating a file dev-app-update.yml in root directory with following content fixed the problem for me of my generic server setup:
provider: generic
url: http://127.0.0.1:8080/releases
channel: latest
@nihalmpatel it worked like a charm!! thanks!!
ๅจๆ น็ฎๅฝไธญๅๅปบๅ
ทๆไปฅไธๅ
ๅฎน็ๆไปถdev-app-update.ymlๅฏไปฅ่งฃๅณๆ็้็จๆๅกๅจ่ฎพ็ฝฎ้ฎ้ข๏ผ
provider: generic
url: http://127.0.0.1:8080/releases
Most helpful comment
Maybe this will help someone for solving this issue. For me it worked creating the
dev-app-update.yml
manually in the top level of my electron app. I am using the two package.json way.My directory structure then looks like this
And in
dev-app-update.yml
I inserted the following for using GitHub:And then normally start your main entry file with
electron main.js
.