Skip to content
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

NSIS Autoupdater Fails to update #945

Closed
MTRNord opened this issue Nov 28, 2016 · 28 comments
Closed

NSIS Autoupdater Fails to update #945

MTRNord opened this issue Nov 28, 2016 · 28 comments

Comments

@MTRNord
Copy link

MTRNord commented Nov 28, 2016

  • Version: 8.6.0
  • Target: Win64 Nsis

I use Github for updates and download works but on install it fails.
My updater code is (imports are simplified):

const {autoUpdater} = require('electron-auto-updater')
function update () {
  setTimeout(function() {autoUpdater.checkForUpdates()}, 30000);
  autoUpdater.on('checking-for-update', function() {
    about.webContents.send('Updater' , {status:'checking'});
    tray.displayBalloon({
      title: 'Autoupdater',
      content: 'Es wird nach Updates geprüft!'
    })
  });

  autoUpdater.on("error", (err) => {
    about.webContents.send('Updater' , {status:'error'});
    console.log(err)
    crashInit()
    tray.displayBalloon({
      title: 'Autoupdater',
      content: 'Ein Fehler ist aufgetreten!'
    })
    //process.crash()
  })

  autoUpdater.on('update-available', function() {
    about.webContents.send('Updater' , {status:'update'});
      tray.displayBalloon({
        title: 'Autoupdater',
        content: 'Es gibt ein Update!'
      })
  });

  autoUpdater.on('update-not-available', function() {
    about.webContents.send('Updater' , {status:'no-update'});
    tray.displayBalloon({
      title: 'Autoupdater',
      content: 'Es gibt kein Update!'
    })
  });


  autoUpdater.on('update-downloaded', function (event, releaseNotes, releaseName, releaseDate, updateUrl, quitAndUpdate) {
    var index = dialog.showMessageBox({
      type: 'info',
      buttons: ['Restart', 'Later'],
      title: "Lornsenschule Vertretungsplan",
      message: ('The new version has been downloaded. Please restart the application to apply the updates.'),
      detail: releaseName + "\n\n" + releaseNotes
    });

    if (index === 1) {
      return;
    }

    quitAndUpdate()
  });
}

Following errorLog comes after starting the install:


Unhandled rejection Error: spawn UNKNOWN
    at exports._errnoException (util.js:1026:11)
    at ChildProcess.spawn (internal/child_process.js:313:11)
    at exports.spawn (child_process.js:392:9)
    at NsisUpdater.install (C:\Program Files\Lornsenschule Vertretungsplan\1.0                                                                                                                    .0\resources\app\node_modules\electron-auto-updater\out\nsis-auto-updater\src\                                                                                                                    NsisUpdater.js:194:61)
    at NsisUpdater.quitAndInstall (C:\Program Files\Lornsenschule Vertretungsp                                                                                                                    lan\1.0.0\resources\app\node_modules\electron-auto-updater\out\nsis-auto-updat                                                                                                                    er\src\NsisUpdater.js:178:18)
    at C:\Program Files\Lornsenschule Vertretungsplan\1.0.0\resources\app\node                                                                                                                    _modules\electron-auto-updater\out\nsis-auto-updater\src\NsisUpdater.js:158:32
    at NsisUpdater.<anonymous> (C:\Program Files\Lornsenschule Vertretungsplan                                                                                                                    \1.0.0\resources\app\main.js:81:5)
    at emitMany (events.js:127:13)
    at NsisUpdater.emit (events.js:201:7)
    at C:\Program Files\Lornsenschule Vertretungsplan\1.0.0\resources\app\node                                                                                                                    _modules\electron-auto-updater\out\nsis-auto-updater\src\NsisUpdater.js:157:28
From previous event:
    at C:\Program Files\Lornsenschule Vertretungsplan\1.0.0\resources\app\node                                                                                                                    _modules\electron-auto-updater\out\nsis-auto-updater\src\NsisUpdater.js:154:20
    at next (<anonymous>)
    at runCallback (timers.js:574:20)
    at tryOnImmediate (timers.js:554:5)
    at processImmediate [as _immediateCallback] (timers.js:533:5)
From previous event:
    at NsisUpdater.doCheckForUpdates (C:\Program Files\Lornsenschule Vertretun                                                                                                                    gsplan\1.0.0\resources\app\node_modules\electron-auto-updater\out\nsis-auto-up                                                                                                                    dater\src\NsisUpdater.js:166:11)
    at C:\Program Files\Lornsenschule Vertretungsplan\1.0.0\resources\app\node                                                                                                                    _modules\electron-auto-updater\out\nsis-auto-updater\src\NsisUpdater.js:117:36
    at next (<anonymous>)
From previous event:
    at NsisUpdater.checkForUpdates (C:\Program Files\Lornsenschule Vertretungs                                                                                                                    plan\1.0.0\resources\app\node_modules\electron-auto-updater\out\nsis-auto-upda                                                                                                                    ter\src\NsisUpdater.js:122:11)
    at Timeout._onTimeout (C:\Program Files\Lornsenschule Vertretungsplan\1.0.                                                                                                                    0\resources\app\main.js:30:38)
    at tryOnTimeout (timers.js:232:11)
    at Timer.listOnTimeout (timers.js:202:5)

@develar
Copy link
Member

develar commented Nov 29, 2016

Does it occurred occasionally or always?

@develar
Copy link
Member

develar commented Nov 29, 2016

Please specify electron-auto-updater version.

@develar develar added the nsis label Nov 29, 2016
@MTRNord
Copy link
Author

MTRNord commented Nov 29, 2016

Where do I get the electron-auto-updater version? And it does occur on every try I made

@develar
Copy link
Member

develar commented Nov 29, 2016

electron-auto-updater is a dependency listed in your package.json.

@MTRNord
Copy link
Author

MTRNord commented Nov 29, 2016

It says ^0.5.0

@develar
Copy link
Member

develar commented Nov 29, 2016

Please use electron-builder 10.2.0 and electron-auto-updater ^0.6.2

@MTRNord
Copy link
Author

MTRNord commented Nov 29, 2016

Ok my deps seem to be messed up. I will try to fix that. thanks for help

@MTRNord
Copy link
Author

MTRNord commented Nov 29, 2016

With yarn it works :)

@moJiXiang
Copy link

Hello, I have the same error. But the different is , the desktop app can update to version 1.0.2 correctly at the first install time with version 1.0.1. But appear 'spawn UNKNOWN' error, when update to version 1.0.3 with version 1.0.2. How did you fix it, and what's yarn? Tks!

@develar
Copy link
Member

develar commented Jan 10, 2017

@moJiXiang Please ensure that you use latest version of electron-auto-updater.

@moJiXiang
Copy link

@develar Thank you. electron-builder ^10.9.2 and electron-auto-updater ^0.9.2.

@develar
Copy link
Member

develar commented Jan 10, 2017

@moJiXiang Sorry for confusion, but latest electron-auto-updater requires latest electron-builder (11.2.1, #925 (comment)).

@moJiXiang
Copy link

@develar Oh, sorry. Try again.

@moJiXiang
Copy link

@develar Sorry, same error again. What's yarn, MTRNord use yarn and it worked.

@MTRNord
Copy link
Author

MTRNord commented Jan 10, 2017

Yarn is a packages alternativ to npm. It is a client tool

https://yarnpkg.com/

@moJiXiang

@moJiXiang
Copy link

@MTRNord Yarn can resolve 'spawn UNKNOWN' error? Why?

@MTRNord
Copy link
Author

MTRNord commented Jan 10, 2017

@moJiXiang yarn did fix some version problems for me. npm didn't provide the newest version on my PC. Yarn did

@develar
Copy link
Member

develar commented Jan 10, 2017

@moJiXiang What version of electron-auto-updater your app 1.0.2 uses?

@moJiXiang
Copy link

moJiXiang commented Jan 10, 2017

@develar All version use electron-auto-updater 0.9.2, I just create a simple demo which use one step nsis and electron-auto-updater 0.10.1 to rule out some unlimited bug. But same error again.

@develar
Copy link
Member

develar commented Jan 10, 2017

@moJiXiang Latest electron-auto-updater version is 0.10.1

@moJiXiang
Copy link

@develar I just create a simple demo which use one step nsis and electron-auto-updater 0.10.1 to rule out some unlimited bug. But same error again.

@moJiXiang
Copy link

@develar I found error on the install step. Code in the NsisUpdater.js script.

(0, (_child_process || _load_child_process()).spawn)(setupPath, args, {
            detached: true,
            stdio: "ignore"
        }).unref();

It like child_process spaw unknown setupPath .

@moJiXiang
Copy link

@develar Hello, I test many times. But I can't ensure it's electron-auto-updater bug, or just my mistake. I'll find someone help me build a windows app to test.

@develar
Copy link
Member

develar commented Jan 11, 2017

@moJiXiang I will do manual testing of latest electron-auto-updater today or tomorrow.

@NunoStreamcato
Copy link

@develar Hi there, I have been having this exact same problem... If I run my installed app normally it throws the error when trying to install the update after download, but if I run the app as administrator it downloads and updates fine. Unfortunately this is not a solution for me, the user as to be able to update the app just by using it normally. Is there a way to force the app to run as administrator (as a last case scenario)?

I have the latest version of electron-builder and electron-auto-updater, updated them today.

Ps: Maybe this has something to do with the app being from an Unknown publisher?

@develar
Copy link
Member

develar commented Jan 12, 2017

Is there a way to force the app to run as administrator (as a last case scenario)?

auto-update must show the same UI (except license page). It seems, currently it is broken.

Sorry for inconvenience. 1.0.0 will be published this month and we will avoid suc regressions in the future. I am working on fix.

@develar
Copy link
Member

develar commented Jan 29, 2017

@moJiXiang Fixed in 12.0.2 as #1129 electron-updater 1.3.0

@saatana97
Copy link

I got the same question and I used electron-builder ^12.3.1,electron-updater ^1.16.0
can not run as administrator after auto update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants