Electron-builder: Location of app-update.yml

Created on 13 Feb 2017  Â·  9Comments  Â·  Source: electron-userland/electron-builder

  • Version:
    electron-builder 13.5.0
    electron-updater 1.6.1

  • Target:
    Win x64
    MacOS


It looks like appUpdater checks for app-update.yml inside the electron dist/resources folder. Without it you'll get an error like:

Error: Error: ENOENT: no such file or directory, open 
'C:\Users\mike\AppData\Roaming\npm\node_modules\electron\dist\resources\app-update.yml'

This is problematic because if you install electron globally and use it to run applications using electron path/to/app, you will need to change the file depending on which app you're running. Even if electron is installed locally you have to place the file in there to do any testing.

I would suggest first looking in the app folder that is running, and then falling back to the electron folder if not found. Or make it configurable so we can set the location.

electron-updater feature

Most helpful comment

@develar You're right, code signing does cause a problem. I tested macOS and got the error, Could not get code signature for running application. I assume the same thing will happen when Windows signing is required.

I think my workaround is good enough for now since it allows me to at least test the update request. This probably doesn't need a fix. But It might be helpful to update the wiki to tell people they need to manually copy the app-update.yml after building if they want to test in dev. Or load it themselves using updateConfigPath.

All 9 comments

auto-update supported only for installed applications. In the dev mode you should not use it. Please use https://github.com/sindresorhus/electron-is-dev to check.

Anyway — PR will be accepted.

Ok, I was able to get it to work by adding this to my code:

if (isDev) {
    autoUpdater.updateConfigPath = path.join(APP_PATH, 'app-update.yml');
}

The reason I need to run it in dev is because my application allows the user to trigger the update check manually, so I need to make sure that everything is working. Thanks for the great work on this project.

@mikecao How does it work on macOS where code sign is required?

Ah, I see that your error about windows (where code sign will be required later ;) if exe is signed).

@develar I haven't tested macOS yet but plan to soon. I'll let you know if I run into any issues.

It is fine if the install part doesn't work because I can always build an installer and test that. But during dev I need to make sure I can at least trigger the update check and perform the download. So far it's working on Windows. When I exit my dev application, it installs the application update externally, so dev doesn't actually get the update, but that's ok.

Too many complains. Reconsidered to be fixed.

@develar You're right, code signing does cause a problem. I tested macOS and got the error, Could not get code signature for running application. I assume the same thing will happen when Windows signing is required.

I think my workaround is good enough for now since it allows me to at least test the update request. This probably doesn't need a fix. But It might be helpful to update the wiki to tell people they need to manually copy the app-update.yml after building if they want to test in dev. Or load it themselves using updateConfigPath.

Maybe something like this will work?

autoUpdater.setConfig({
  provider: 'generic',
  url: 'https://website.com/download',
  channel: 'latest'
});

Production can still use the app-update.yml file while in dev you will have to configure it manually.

In the next version file dev-app-update.yml will be searched in the app path in a dev mode. Prefix dev- is used to make it clear, that file only for a dev mode.

Was this page helpful?
0 / 5 - 0 ratings