Uncaught Exception during autoupdate with electron builder


#1

Hi,
I’ve implemented the autoupdate feature of an Electron app usingelectron-builder 20.28.4 and ‘nsis’ as target.
I’ve this configuration in the filepackage.json:

"nsis": {
  "allowElevation": false,
  "allowToChangeInstallationDirectory": false,
  "oneClick": false,
  "perMachine": true,
  "installerIcon": "./app/assets/icons/icon.ico",
  "uninstallerIcon": "./app/assets/icons/icon.ico",
  "license": "./app/LICENSE",
  "runAfterFinish": true
},
"publish": [
  {
    "provider": "github",
    "owner": "myaccount",
    "repo": "myrepository"
  }
]

and this is the function that inits the updater:

function initUpdater() {
  autoUpdater.on('checking-for-update', () => {
    log.info('Checking for update...')
  })
  autoUpdater.on('update-available', (ev, info) => {
    log.info('Update available.', info)
  })
  autoUpdater.on('update-not-available', (ev, info) => {
    log.info('Update not available.', info)
  })
  autoUpdater.on('error', (ev, err) => {
    log.info('Error in auto-updater.', err)
  })
  autoUpdater.on('download-progress', (progressObj) => {
    let log_message = "Download speed: " + progressObj.bytesPerSecond
    log_message = log_message + ' - Downloaded ' + progressObj.percent + '%'
    log_message = log_message + ' (' + progressObj.transferred + "/" + progressObj.total + ')'
    log.info(log_message)
  })
  autoUpdater.on('update-downloaded', (ev, info) => {
    log.info('Update downloaded; will install in 5 seconds', info)
    autoUpdater.quitAndInstall();
  });
}

When the app starts in the log file I can see that a new version of the app is found and downloaded:

[2018-09-21 18:21:00.305] [info] New version 0.0.5 has been downloaded to C:\Users…_update_\myprogram-setup-0.0.5.exe
[2018-09-21 18:21:00.310] [info] Update downloaded; will install in 5 seconds undefined

But the installation fails with this error:

Uncaught Exception: 
Error: spawn C.\Users\...\__update__\myprogram-setup-0.0.5.exe EACCESS 
at Process.ChildProcess._handle.onexit(internal/child_process.js:229:19)
at onErrorNT (internal/child_process.js:406::16)
at process._tickCallback (internal/process/next_tick.js:63:19)

In the directory __update__ I can see the executable and if I use the file in this directory it works well.
How can I debug this error?
Thank you very much.
I’m using Electron 3.0.0.

cld