electron / update-electron-app

🌲 A drop-in module that adds autoUpdating capabilities to Electron apps
MIT License
735 stars 130 forks source link

Can not successfully restart and switch to new version after downing #78

Open dadiorchen opened 3 years ago

dadiorchen commented 3 years ago

My case is:

  1. The log shows new version downloaded (see log below)
  2. The update dialog shows up correctly.
  3. After clicking the restart button, the app closed, and start successfully
  4. But, the version still remains the same, old version, and the app goes to the next round of downloading...

My computer version: Mac Catalina version 10.15.7 (19H114)

My modules in the pacakge.json

  "devDependencies": {
    "@electron-forge/cli": "^6.0.0-beta.54",
    "@electron-forge/maker-deb": "^6.0.0-beta.54",
    "@electron-forge/maker-rpm": "^6.0.0-beta.54",
    "@electron-forge/maker-squirrel": "^6.0.0-beta.54",
    "@electron-forge/maker-zip": "^6.0.0-beta.54",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "@types/jest": "^26.0.15",
    "@types/node": "^12.0.0",
    "@types/react": "^16.9.53",
    "@types/react-dom": "^16.9.8",
    "electron": "^11.1.1",
    "electron-reloader": "^1.1.0",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-scripts": "4.0.1",
    "sinon": "^9.2.2",
    "typescript": "^4.0.3",
    "web-vitals": "^0.2.4"
  },
  "dependencies": {
    "@material-ui/core": "^4.11.2",
    "@material-ui/icons": "^4.11.2",
    "axios": "^0.21.1",
    "du": "^1.0.0",
    "electron-log": "^4.3.1",
    "electron-squirrel-startup": "^1.0.0",
    "expect-runtime": "^0.10.0",
    "glob": "^7.1.6",
    "iconutil": "^1.0.2",
    "loglevel": "^1.7.1",
    "lunr": "^0.7.1",
    "lunr-languages": "git+https://github.com/dadiorchen/lunr-languages.git#any-work-tokenizer",
    "plist": "^3.0.1",
    "pouchdb": "^7.2.2",
    "pouchdb-quick-search": "^1.3.0",
    "shelljs": "^0.8.4",
    "update-electron-app": "^2.0.1"
  },

The log in the ~/Library/Logs/[myappname]/main.log

[2021-05-14 16:53:43.468] [info] init db, reset the db...
[2021-05-14 16:53:43.855] [info] checking-for-update
[2021-05-14 16:53:45.299] [info] update-not-available
[2021-05-14 16:58:43.456] [info] checking-for-update
[2021-05-14 16:58:44.923] [info] update-available; downloading...
[2021-05-14 16:59:14.749] [info] update-downloaded [
  {
    preventDefault: '[function] function preventDefault() { [native code] }',
    sender: {
      checkForUpdates: '[function] function checkForUpdates() { [native code] }',
      getFeedURL: '[function] function getFeedURL() { [native code] }',
      setFeedURL: '[function] function setFeedURL() { [native code] }',
      quitAndInstall: '[function] function quitAndInstall() { [native code] }',
      _events: {
        error: "[function] err => {\n    log('updater error')\n    log(err)\n  }",
        'checking-for-update': "[function] () => {\n    log('checking-for-update')\n  }",
        'update-available': "[function] () => {\n    log('update-available; downloading...')\n  }",
        'update-not-available': "[function] () => {\n    log('update-not-available')\n  }",
        'update-downloaded': '[function] (event, releaseNotes, releaseName, releaseDate, updateURL) => {\n' +
          "      log('update-downloaded', [event, releaseNotes, releaseName, releaseDate, updateURL])\n" +
          '\n' +
          '      const dialogOpts = {\n' +
          "        type: 'info',\n" +
          "        buttons: ['Restart', 'Later'],\n" +
          "        title: 'Application Update',\n" +
          "        message: process.platform === 'win32' ? releaseNotes : releaseName,\n" +
          "        detail: 'A new version has been downloaded. Restart the application to apply the updates.'\n"
+
          '      }\n' +
          '\n' +
          '      dialog.showMessageBox(dialogOpts).then(({ response }) => {\n' +
          '        if (response === 0) autoUpdater.quitAndInstall()\n' +
          '      })\n' +
          '    }'
      },
      _eventsCount: 5
    }
  },
  '',
  'Test auto-update',
  '1970-01-01T00:00:00.000Z',
  'https://github.com/dadiorchen/dadiorapp/releases/download/v1.0.3/dadiorapp-darwin-x64-1.0.3.zip'
]
[2021-05-14 16:59:48.038] [info] update app...
[2021-05-14 16:59:48.050] [debug] retrun from updater: undefined
[2021-05-14 16:59:48.200] [info] feedURL https://update.electronjs.org/dadiorchen/dadiorapp/darwin-x64/1.0.2
[2021-05-14 16:59:48.200] [info] requestHeaders { 'User-Agent': 'update-electron-app/2.0.1 (darwin: x64)' }
[2021-05-14 16:59:48.228] [info] NODE_ENV:undefined, dbFilePath:/Users/deanchen/Library/Application Support/dadio
rapp/data/
[2021-05-14 16:59:48.237] [info] init db, reset the db...
[2021-05-14 16:59:51.533] [info] checking-for-update
[2021-05-14 16:59:53.021] [info] update-available; downloading...
maccman commented 1 year ago

Also seeing the same thing with https://reflect.app