Giter Site home page Giter Site logo

develar / electron-updater Goto Github PK

View Code? Open in Web Editor NEW
217.0 11.0 22.0 194 KB

Deprecated. Part of electron-builder now.

Home Page: https://github.com/electron-userland/electron-builder/tree/master/packages/electron-updater

License: MIT License

JavaScript 98.47% CSS 0.38% HTML 1.16%

electron-updater's Introduction

NOTE

Project on NPM since version 1.0.0 is a part of electron-builder.

This original project is in maintainance only mode. It is recommended that you use the electron-builder project to generate complete installable versions of your applications and use either the OS specific stores or some other mechanism for distributing your installers.

electron-updater's People

Contributors

arvsr1988 avatar develar avatar justinmchase avatar vitapluvia avatar vj3k0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

electron-updater's Issues

Random Error from appendToConsole in Logger

I randomly get an error that bubbles to the user. It is in lib/Logger.js. In appendToConsole, it attempts to write something to the console. I would love to wrap this in a try/catch so that it doesn't bubble to the user. If I PR this, would you accept?

screen shot 2015-12-05 at 10 13 17 pm

Pass old and new versions into the `updateAvailable`

Having the old and new version passing into the updateAvailable callback would allow the consumers of electron-updater to react differently to a patch update verses a minor or major update.

In some cases, you may want to only request that the user update. In others, you may want to prevent them from using the app until the user updates. These kinds of things would be enabled if we passed those versions into the updateAvailable callback.

Support for different npm package name

Currently the updater uses the application name to get the updates but since a library is already registered under my application's name, I wish to push my application under a different package name instead of managing a private npm server. I can do a PR as I think only few changes are to be made in index.js, lib/check.js and command.js are required it seems.

emitError is not a function

I've created a distributable (.exe) file with Squirrel for Windows, and i'm running into this error:

Uncaught Exception:
TypeError: this.emitError is not a function
at App.checkForUpdates
(.....electron.asar/brow...:19)
at emitTwo (events.js:111:20)
at App.emit (events.js:191:7)

Silent updates

I really like the idea of just using npm for packages and updates. Makes it a lot easier than the way Atom does it.

What I want though is silent updates without bothering users. Like Chrome.

Meaning:

  • The update is downloaded in the background
  • The user is never bothered about it, but there are events to notify if wanted.
  • When the user decides to quit the app and start it again, the new version is started.
  • To use this module it should just require a simple oneliner. Something like: require('electron-updater')()

Not enough information in README

Hi, @justinmchase.
You are doing a great work. I tried to use electron-update, but can't figure out:

  1. Where updater get URL of update API for Application.
  2. How response should looks like?
  3. If I have a new version for Application, what should contain file which updater will download. I mean what files?

Thanks in advance!

Electron Windows App uninstaller permission

electron version : 1.7.6
electron-updater : 2.8.9
Platform : WIndows 10

I am building electron app for windows using NSIS built. Whenever a new setup is executed on top of an older already installed app/or auto-updating (Since auto update also installs the new version) it first runs the uninstaller for the older app and then continues proceeding the installation for the new version(always maintaining one app across the system). This is working fine on some machines whereas it throws an error while uninstalling the older version on some machines.
On erroneous machines, tried running the uninstaller through the file system also throws "No permission to access this file)".
Confirmed the erroneous machine user is an admin user.
So 2nd time installation or update doesn't succeed because of user privileges.
Allowed (User Account Control) prompt while installing as well as updating.
These are my NSIS build options
"nsis": {
"oneClick": false,
"perMachine": true,
"allowElevation": true,
"allowToChangeInstallationDirectory": false,
"menuCategory": true,
"installerIcon": "./icons/win.ico",
"uninstallerIcon": "./icons/win.ico",
"uninstallDisplayName": "${productName} ${version}",
"installerSidebar": "./build/installerSidebar.bmp",
"deleteAppDataOnUninstall": true
}

This is the error popup I receive while installing or updating
pasted image at 2017_10_17 11_20 am

The issue resolves itself on restarting the system for erroneous machines

Where to download binary from

Possibly related to this: #3

When I'm working locally and I set my electron app version behind what's on npm and run it, it refreshes my local version and it updates. I'm not committing my app to npm, however, and I'd rather handle releases through GitHub. If I want users' apps to download the new version and then have the new one replace the old, where would I tell electron-updater to look for that latest GitHub release?

The updater should never be caught in an update loop

It's possible for the app to be in a bad state, such as a specific version of a dependency doesn't actually exist. For example if you are asking for dependency "example": "1.0.0" and that version doesn't exist, the app will check to see if its valid, fire the 'udpateRequired' event and then go to update. The updater will then ask for that dependency, fail to find it because it doesn't exist and then fail to update.

In this situation, its possible for the updater to attempt to restart the app, which will then attempt to update again and then loop endlessly.

This kind of update cycle should not happen, in this case it should show a critical error dialog. Inform the user to try again later, repair or reinstall the app and then exit fully. If the user re-runs the app it should go through the same cycle of attempting to update and then gracefully handling the error (if the error condition still exists).

Bug affiliated with package-name

Not able to track this one down, there is no error logging on this one that I can find. App exits at launch without notice. changing the package-name fixes it. changing the package name back to a previously 'broken' package name will again keep the app from launching without any error.

Force updater

How can i force the updater to run?. So i am using electron-updater with electron-plugins. so the intention is that when a user clicks update or install on a plugin, this modifies my jason file on the fly and then i need to force an update.
I have tried to call updater.check and updater.update but they all fail in:

assert.ok(callback = values[2])

for what i get the next exeption always:

Uncaught Exception:
AssertionError: undefined == true
    at Object.<anonymous> (/home/knek/code/koteky/node_modules/electron-updater/lib/commands.js:73:10)
    at expect (/home/knek/code/koteky/node_modules/electron-updater/lib/commands.js:32:33)
    at ElectronCommands.check (/home/knek/code/koteky/node_modules/electron-updater/lib/commands.js:70:2)
    at EventEmitter.electron.ipcMain.on (/home/knek/code/koteky/main.js:74:13)
    at emitOne (events.js:77:13)
    at EventEmitter.emit (events.js:169:7)
    at EventEmitter.<anonymous> (/home/knek/code/koteky/node_modules/electron-prebuilt/dist/resources/atom.asar/browser/api/web-contents.js:134:25)
    at emitTwo (events.js:87:13)
    at EventEmitter.emit (events.js:172:7)

Should check if app is online before checking/updating.

I'm currently working on an Electron application that will be primarily online, but occasionally offline when out in the field. The updater does not seem to handle offline well - especially if there is a pending update.

I'm looking into patching this feature in, but if you have any tips or thoughts, please share!

Unclear on how to update electron binary

I'm sorry if this is just me not fully understanding your project, but let me try and clarify things for myself if I can.

I've included electron-updater in my project, and I have sinopia running locally. I have all my js/html/css in a build/ dir (along with the app package.json). I have added registry: http://localhost:4873 to my package.json.

I imagine that updates work like this; I pack and publish a new version of my build/ dir. The running app automatically downloads (does electron-updater handle the downloading) the new js/html/css and I can handle the update event in main.js to restart with the new application code. Am I correct so far?

1: That's all fine for replacing the app code if I push a new version, but what about when electron-prebuilt gets updated? How does it replace the electron binary? In packaged applications the electron binary is branded for your application so I'm not really sure how this would work.

2: I see you can add a binaries: into the package.json but I'm still not sure the sequence of events I would do.

3: I can currently use electron-packager to get a branded release of my code, would I run that, then npm pack and npm publish the archive containing the executable and all of the subfolders?

4: what are the scenarios where you get "update available" vs "update required"? Im in a situation where I published my app with a certain version number, then edited the package.json to be lower and sometimes I'll run the app and it gets an update required and restarts with the new code, whereas other times I won't get the spinner at all and just an "update available" log. It seems to alternate between the two; I expected the behaviour to always update on app start.

5: is there an example project with electron-updater implemented?

Sorry for asking to many questions at once. I've edited this several times to try and clean it up.

How to solve the "permission denied" problem?

When I use the "sudo npm start" command,the app can update . But when I use "npm start",update is denied. Maybe other user don't want to use the "sudo" command, they don't want to type the password.
Is it necessary to use the root user to update the app? How can I avoid typing password?

update require of ipc

Because electron updater has a require("ipc") call, every one who uses it will get a message in their console like this:

image

We should update the call to require('electron').ipcMain; to get rid of the warning in the console.

Updater test tool

It would be nice if there was a tool that a app developer could run during CI builds or manually, that would indicate whether or not the local app had any dependency problems. Something like check except that it would just spin through the dependency hierarchy and verify that all of the packages exist and have no problems.

Stuck in the updating page

I test the electron-updater in the electron-quick-start. When the app runs, it can Checking for updates,and shows Updates are available too . Then I close and restart the app by typing "npm start" ,the updating page shows, saying "Updating". But noting change ,and the app stuck in the updating page.

I try many times, its still not working . Can you help me solve this ? thank you!

log is here:
[24/01/2016:23:18:59:994:log:91997] Checking for updates.
[24/01/2016:23:19:06:995:log:91997] Updates are available.
[24/01/2016:23:19:27:132:log:92030] Update is pending, exiting...
[24/01/2016:23:19:27:134:log:92030] execPath:/Users/yuxizhe/electron/new/node_modules/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron
[24/01/2016:23:19:27:135:log:92030] copy appDir: /Users/yuxizhe/electron/new/node_modules/electron-prebuilt/dist/Electron.app
[24/01/2016:23:19:27:135:log:92030] updateDir: /Users/yuxizhe/Library/Application Support/electron-quick-start/updater/0.36.5
[24/01/2016:23:19:27:386:log:92030] args: '{"appName":"electron-quick-start","publisher":"electron-quick-start","cwd":"/Users/yuxizhe/electron/new","exe":"/Users/yuxizhe/electron/new/node_modules/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron","argv":["main.js"]}'
[24/01/2016:23:19:27:385:log:92030] Launching update process:
[24/01/2016:23:19:27:386:log:92030] exe: /Users/yuxizhe/Library/Application Support/electron-quick-start/updater/0.36.5/Contents/MacOS/Electron
[24/01/2016:23:19:27:386:log:92030] cwd: /Users/yuxizhe/electron/new
[24/01/2016:23:19:27:386:log:92030] updateDir: /Users/yuxizhe/electron/new/node_modules/electron-updater
[24/01/2016:23:19:27:671:log:92035] Starting Update:
[24/01/2016:23:19:27:674:log:92035] args: { appName: 'electron-quick-start',
publisher: 'electron-quick-start',
cwd: '/Users/yuxizhe/electron/new',
exe: '/Users/yuxizhe/electron/new/node_modules/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron',
argv: [ 'main.js' ] }

Add blurb to doc about "Must Have Error Callback"

If you don't have an updater.on('error', fn) listener, all errors from the updater will bubble to the end users. Modify the documentation to include an explanation of this behavior. You must have the error handler, even if it is empty, it just has to exist.

A little logic issue?

First here to say, good job, bro. this is what we were considering months ago.

I've played this for a well, and found a little bug maybe, if it is not intended.

It lies in update.js:
n fc6 mkq27a iui bb

According to this logger:
[05/08/2015:10:25:06:394:log:14772] after push deps are: { context:
{ name: 'electron-updater-play-1',
version: '1.1.0',
publisher: 'electron-updater-play-1',
channel: 'latest',
dev: true,
updatePending: false,
updateInProgress: true,
registry: 'https://registry.npmjs.org',
appDir: 'f:\EolderInUse',
dependencies: { 'electron-updater': '^0.0.x', 'electron-plugins': '^0.0.x' },
plugins: { 'electron-updater-sample-plugin': '^0.0.2' } },

dev is set to true. So it cannot pass the if logic highlighted in the picture above.

What I guess is that you might submit a dev version by mistake.

Instead of using file watcher, use named pipe.

Currently, if a user says no to elevation there is no way to know and the updater waits indefinitely. Instead create a named pipe and timeout if nothing connects. Use that to send messages more directly instead of using the pending update file which can get someone stuck if the file isn't cleaned up properly.

I am getting below error after app update

Thanks for awesome work :)

Kindly help on below error.

Starting...
Update is pending, exiting...
execPath:/usr/local/lib/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron
copy appDir: /usr/local/lib/node_modules/electron/dist/Electron.app
updateDir: /Users/apple/Library/Application Support/my-support-app2/updater/1.4.15
{ Error: ENOTDIR: not a directory, stat '/usr/local/lib/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar/default_app.js'
at Error (native)
errno: -20,
code: 'ENOTDIR',
syscall: 'stat',
path: '/usr/local/lib/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar/default_app.js' }
errr
{ Error: ENOTDIR: not a directory, stat '/usr/local/lib/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar/default_app.js'
at Error (native)
errno: -20,
code: 'ENOTDIR',
syscall: 'stat',
path: '/usr/local/lib/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar/default_app.js' }

Download prebuilt binaries when fetching dependencies

When updating a particular package look in its package.json for a "binaries" section. Use the app name, current systems platform, architecture, configuration and channel to fetch and unpack binaries from the provided urls.

e.g.

"binaries": [
    "https://s3.amazonaws.com/example-bin/{name}/{name}-{version}-{platform}-{arch}-{configuration}-{channel}.tgz"
  ],

Add documentation for semver syntax and how it affects updater

Because electron-updater will watch each of the dependencies listed in package.dependencies, people will likely want to avoid using the carrot in their semver. An example: instead of "angular": "^1.4.7" you will want to use "angular": "1.4.7", without the carrot.

Add the section to the documentation that when switching from using the carrot to not using the carrot, make sure and run npm outdated to get a list of the outdated deps in their package.dependencies. Then update their semvers with the versions listed in the outdated call. @justinmchase and I ran into an issue with this, and likely more people will.

spawn EACESS error

screen shot 2015-07-14 at 01 55 37 am

I first thought this was a path escaping issue (not escaping the space) so I added tmpExecPath.replace(/ /g, '\\ ') at command.js:152 but that didn't do anything.

I then ran chmod +x on /Users/mike/Library/Application Support/updater/0.28.3/Electron and that seemed to work when testing locally but it gives me the same error after I build the application.

Missing package.json key leads to errors

Excluding the "plugins": {} key/value from the package.json yields a non-helpful error:

Cannot convert undefined or null to object

Please either catch such a situation with a better error or add instructions to the documentation.

Error during update can leave updater in bad state

Its possible for the updater to fail and be left in a "PENDING" state, which causes the client to fail to load.

In case of error the .update file should always be left empty, allowing the client to re-evaluate the necessity of updates.

Possible race condition updating plugins

Currently the plugins are asynchronously writing their versions to the .current file after they are done updating. It's possible for them to read and then write, interleaved causing a version to not increment properly. This could result in the updater running twice in a row.

When updating a plugin, return the new version. After all plugins are done updating, write them all to the .current file.

electron 1.X+ crash

First of all thanks for all your help all this times i have posted i really apreciate your help.

i have tried to update my app to electron 1. and i am finding a crash due electron-updater. i was trying to find where it could be comming from to do a pull request to solve it, but i am unable to locate the issue.

plugin check: [ { name: 'koteky-twitter',
    current: '0.0.0',
    desired: '0.4.7',
    valid: false } ]
Plugins are not valid.
execPath:/home/knek/code/koteky/node_modules/electron-prebuilt/dist/electron
copy appDir: /home/knek/code/koteky/node_modules/electron-prebuilt/dist
  updateDir: /home/knek/.local/share/koteky/updater/1.2.0
{ Error: ENOTDIR: not a directory, stat '/home/knek/code/koteky/node_modules/electron-prebuilt/dist/resources/default_app.asar/default_app.js'
    at Error (native)
  errno: -20,
  code: 'ENOTDIR',
  syscall: 'stat',
  path: '/home/knek/code/koteky/node_modules/electron-prebuilt/dist/resources/default_app.asar/default_app.js' }

seems electron has change some of the location of their files that electron-updater is looking for. Interesting enough this only happens if the update (for a plugin in my case) happens when the plugin is already in package.json on first run. if its added on the fly and an update is forced all work correctly even after restart the app.

The only workaround i have found till now is not call updater.start and relly on manually call updater.update

Ever consider that user just want to keep an older version of a package?

This is the satisfy function in check.js

function satisfy(registry, name, desired, current, exists, callback) {
  var url = registry + '/' + name
  got(url, {json:true}, function (err, data) {
    if(err) return callback(err)
    var versions = data.versions
    var available;
    Object.getOwnPropertyNames(data.versions).forEach(function (v) {
      if(semver.satisfies(v, desired) && (!available || semver.gt(v, available))) {
        available = v
      }
    })

    if(available && (!exists || semver.gt(available, current))) {      
      return callback(null, {
        name: name,
        desired: desired,
        current: current,
        available: available
      })
    }

    // We already have the most up-to-date version
    callback()
  })
}

when there is an greater available version, it will tell the app to update as there is a dependency package need to be updated.

Here is what I captured in my log.
image

My current equals my desired, but smaller than available. This will trigger an update.

Looks like "var desired" is not used? Sometimes user may just want to keep a stable version for some pkgs for a stable app.

Does electron-updater work for portable app?

I've just started to explore electron app auto-updates. My project currently has a requirement to be portable. That is, it shouldn't be installed onto the user's machine. The auto-updater directly supported by Atom Electron is tied to Squirrel installer so that doesn't work for me. I wanted to see if electron-updater can work.

I produce a release the same way you would prepare a release for installation but without packaging it into installation. That is, copy of electron runtime, .asar archives and a few other files are in the folder along with package.json.

I've applied the electron-updater bootstrap to the electron application as well as an ipc listener to the render thread.

My assumption is that when I start the app, electron-updater parses package.json, looks at all dependencies, ensures that they are of the latest release, and starts the app. How does electron-updater know when to install updates of the application itself? Is that what binaries are for? However, it seems like in the examples, it is just a path to a tar archive and not to an npm. Or does it assume that the application is hosted on npm packages under the name ins the package.json and tries to check for the latest version? If that is the case, how can I see some verbose output of electron-updater? I've installed sinopia and hosted my package locally. But I do not see electron-updater checking for it or showing any errors. Is that because my application hasn't actually been installed?

Full updater needs to elevate on windows

When launching the full updater process, elevate, since the full updater may need to update the app itself or dependencies that reside in a folder the user doesn't have permissions to edit.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.