question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Auto-update not working on WIN10

See original GitHub issue

Here what I’m experiencing:

  • I have both releases 0.1.31 and 0.1.32 on the repo GitHub
  • I install 0.1.31
  • I start 0.1.31
  • nothing is prompt (should checkForUpdateAndNotify() notify user about the new update?)
  • app closes

Code:

app.on('ready', async () => {
    //try to update!
    try {
        const info = await autoUpdater.checkForUpdatesAndNotify();
        logger.info('checkForUpdatesAndNotify');
        logger.info(JSON.stringify(info));

        autoUpdater.on('update-downloaded', info => {
            const quitAndInstalled = autoUpdater.quitAndInstall();
            logger.info('quitAndInstalled');
            logger.info(quitAndInstalled);
        });

        autoUpdater.on('update-available', arg => {
            logger.info('update-available');
            logger.info(arg);
        });

        autoUpdater.on('update-not-available', arg => {
            logger.info('update-not-available');
            logger.info(arg);
        });

        autoUpdater.on('download-progress', arg => {
            logger.info('download-progress');
            logger.info(arg);
        });

        autoUpdater.on('error', error => {
            logger.info('error');
            logger.info(error.message);
            logger.info(error.stack);
        });
    }
    catch (error) {
        logger.info('autoupdate failed');
    }

    createWindow();
    createOrSyncTrayAndMenu();
});

Here what log.log in %appdata% says:

C:\Users\damiano\AppData\Roaming\TAV>type log.log
[2018-06-04 15:58:22.514] [info] ["C:\\Users\\damiano\\AppData\\Local\\Programs\\TAV\\TAV.exe"]
[2018-06-04 15:58:22.579] [info] { defaultProtocolClientSet: true }
[2018-06-04 15:58:23.119] [info] Checking for update
[2018-06-04 15:58:23.365] [info] Generated new staging user ID: d3158bfd-196b-5f31-86ff-5d8941285791
[2018-06-04 15:58:26.478] [info] Found version 0.1.33 (url: TAV.exe)
[2018-06-04 15:58:26.478] [info] Downloading update from TAV.exe
[2018-06-04 15:58:26.478] [info] checkForUpdatesAndNotify
[2018-06-04 15:58:26.478] [info] {"versionInfo":{"version":"0.1.33","files":[{"url":"TAV.exe","sha512":"WdNsGytxp51XzHTEwUijfcG7H1fTt9jcWeQZb+0ukDUpj+i1btPqvVO6sysjwq03QZQP9/2F9mMbcm5+99rfAg==","size":46203281}],"path":"TAV.exe","sha512":"WdNsGytxp51XzHTEwUijfcG7H1fTt9jcWeQZb+0ukDUpj+i1btPqvVO6sysjwq03QZQP9/2F9mMbcm5+99rfAg==","sha2":"8a0c29d271deae77b0d4799c6678fd3a3cf743df03aa9a0703dadfe7d378b4fb","releaseDate":"2018-06-04T10:12:02.502Z","releaseName":"0.1.33","releaseNotes":""},"updateInfo":{"version":"0.1.33","files":[{"url":"TAV.exe","sha512":"WdNsGytxp51XzHTEwUijfcG7H1fTt9jcWeQZb+0ukDUpj+i1btPqvVO6sysjwq03QZQP9/2F9mMbcm5+99rfAg==","size":46203281}],"path":"TAV.exe","sha512":"WdNsGytxp51XzHTEwUijfcG7H1fTt9jcWeQZb+0ukDUpj+i1btPqvVO6sysjwq03QZQP9/2F9mMbcm5+99rfAg==","sha2":"8a0c29d271deae77b0d4799c6678fd3a3cf743df03aa9a0703dadfe7d378b4fb","releaseDate":"2018-06-04T10:12:02.502Z","releaseName":"0.1.33","releaseNotes":""},"cancellationToken":{"domain":null,"_events":{},"_eventsCount":0,"parentCancelHandler":null,"_parent":null,"_cancelled":false},"downloadPromise":{"isFulfilled":false,"isRejected":false}}
[2018-06-04 15:58:26.633] [info] No cached update available

I can see a temp.exe file in the app data folder:

C:\Users\damiano\AppData\Roaming\TAV>dir
 Il volume nell'unità C non ha etichetta.
 Numero di serie del volume: 12F5-187B

 Directory di C:\Users\damiano\AppData\Roaming\TAV

04/06/2018  15:58    <DIR>          .
04/06/2018  15:58    <DIR>          ..
04/06/2018  15:58                36 .updaterId
04/06/2018  15:58    <DIR>          Cache
04/06/2018  15:58            28.672 Cookies
04/06/2018  15:58                 0 Cookies-journal
04/06/2018  15:58    <DIR>          GPUCache
04/06/2018  15:57        46.203.376 installer.exe
04/06/2018  15:58             1.703 log.log
04/06/2018  15:58    <DIR>          logs
04/06/2018  15:58         5.377.381 temp-installer-0.1.33.exe <== here!

But If I try to open it manually I get the following: screen shot 2018-06-04 at 16 02 34

I see the temp-installer.exe is just 5MB while the .exe in the release on GitHub is 44MB. I’m not sure whether a differential download is made (is this possible?) but I think the file download failed without firing the ‘error’ event (resulting a corrupted .exe file). Furthermore update-downloaded event is not logged, so probably the app is not closed by the autoUpdater.quitAndInstall() call?

What do you think? Is this a bug?

Versions and nsis config:

{
    "build": {
        ...
        "asar": true,
        "win": {
            "target": "nsis",
            "icon": "./icons/logo.ico",
            "publisherName": "Translated SRL"
        },
        "nsis": {
            "oneClick": false,
            "perMachine": true,
            "allowElevation": true,
            "deleteAppDataOnUninstall": true,
            "createDesktopShortcut": "always",
            "menuCategory": "Translated - TAV",
            "installerHeaderIcon": "./icons/logo.ico",
            "installerIcon": "./icons/logo.ico",
            "uninstallerIcon": "./icons/logo.ico",
            "installerSidebar": "./icons/win-installer-sidebar.bmp",
            "installerHeader": "./icons/win-installer-header.bmp",
            "uninstallerSidebar": "./icons/win-uninstaller-sidebar.bmp",
            "license": "./assets/license.txt"
        },
        ...
    },
    "dependencies": {
        "auto-launch": "^5.0.5",
        "better-console": "^1.0.1",
        "electron-log": "^2.2.14",
        "electron-updater": "^2.21.10",
        "lodash": "^4.17.10",
        "luxon": "^1.2.1",
        "mz": "^2.7.0",
        "sleep-promise": "^6.0.0",
        "typeface-montserrat": "^0.0.54",
        "ws": "^5.1.1"
    },
    "devDependencies": {
        "babel-eslint": "^8.2.3",
        "electron": "^2.0.1",
        "electron-builder": "^20.13.4",
        "electron-debug": "^1.5.0",
        "electron-reload": "^1.2.2",
        "eslint": "^4.19.1",
        "eslint-loader": "^2.0.0",
        "eslint-plugin-jest": "^21.15.0",
        "eslint-plugin-react": "^7.7.0",
        "png2icns": "^0.0.1"
    }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
damianobarbaticommented, Jul 20, 2018

Smart move, thanks @peterdanis! I’m packing locally triggering the update without pushing to GitHub.

However the app just dies in the middle of downloading update with no error. I tried removing the makeSingleInstance logic but it doesn’t matter. Notification with checkForUpdatesAndNotify never worked.

Any idea? I’ve run out of ideas 😔

1reaction
brennomarquescommented, May 18, 2020

Do you want some help, for example: I have an application that can update what this server does not, but it downloads that update but does not update, something that is missing? follow my .json and main.js

{
  "name": "assistente",
  "version": "1.0.0",
  "main": "main.js",
  "scripts": {
    "start": "electron .",
    "dist": "electron-builder"
  },
  "build": {
    "appId": "com.example.app",
    "publish": [
      {
        "provider": "generic",
        "url": "http://localhost:80/"
      }
    ]
  },
  "devDependencies": {
    "electron": "^8.2.5",
    "electron-builder": "^22.6.0"
  },
  "dependencies": {
    "electron-log": "^4.1.2",
    "electron-updater": "^4.3.1"
  }
}
const { app, BrowserWindow, dialog } = require('electron')
const { autoUpdater } = require("electron-updater")
const log = require('electron-log');

autoUpdater.logger = log;
autoUpdater.logger.transports.file.level = 'info';


function createWindow() {
    // Cria uma janela de navegação.
    let win = new BrowserWindow({
        width: 800,
        height: 600,
        webPreferences: {
            nodeIntegration: true
        }
    })

    // e carregar o index.html do aplicativo.
    win.loadFile('index.html')
    autoUpdater.checkForUpdates();
}

app.whenReady().then(createWindow)

autoUpdater.on('update-available', info => {
    log.info('update-available');
    const dialogOpts = {
        type: 'info',
        buttons: ['Atualizar', 'Agora Não'],
        title: 'Atualização do Aplicativo',
        message: 'Atualização Disponível',
        detail: 'Uma nova versão do Assistente está disponível. É preciso reiniciar o aplicativo para aplicar as atualizações.'
    }

    dialog.showMessageBox(dialogOpts, (response) => {
        if (response === 0) autoUpdater.quitAndInstall()
    })

});

The .logs file looks like this …,

[2020-05-18 11:34:00.555] [info] Checking for update
[2020-05-18 11:34:01.995] [info] Found version 2.0.0 (url: assistente Setup 2.0.0.exe)
[2020-05-18 11:34:02.001] [info] update-available
[2020-05-18 11:34:02.012] [info] Downloading update from assistente Setup 2.0.0.exe
[2020-05-18 11:34:02.028] [info] Cached update sha512 checksum doesn't match the latest available update. New update must be downloaded. Cached: r0pMhztQ0DLw1hL4ttKErU9RX1nLHC55sG2z7UDlUskA/rprCq7oVhZSUXa0qiSb2s16kapo6WAuwaBy2vSXZQ==, expected: qH+svT/BpBErAhpds6f5XeZRjNGpR+qZOcle/BQYjhIgDiQASs0siPQaCtNynelen3mbu4G5neWL9tNOeN18pw==. Directory for cached update will be cleaned
[2020-05-18 11:34:02.053] [info] Download block maps (old: "http://localhost/assistente%20Setup%201.0.0.exe.blockmap", new: http://localhost/assistente%20Setup%202.0.0.exe.blockmap)
[2020-05-18 11:34:02.093] [error] Cannot download differentially, fallback to full download: Error: Cannot download "http://localhost/assistente%20Setup%201.0.0.exe.blockmap", status 404: Not Found
    at ClientRequest.<anonymous> (C:\Users\brenno\AppData\Local\Programs\seu-app\resources\app.asar\node_modules\builder-util-runtime\out\httpExecutor.js:280:26)
    at ClientRequest.emit (events.js:210:5)
    at SimpleURLLoaderWrapper.<anonymous> (electron/js2c/browser_init.js:2510:12)
    at SimpleURLLoaderWrapper.emit (events.js:210:5)
[2020-05-18 11:34:03.697] [info] New version 2.0.0 has been downloaded to C:\Users\brenno\AppData\Local\assistente-updater\pending\assistente Setup 2.0.0.exe
[2020-05-18 11:34:06.910] [info] Auto install update on quit
[2020-05-18 11:34:06.918] [info] Install: isSilent: true, isForceRunAfter: false
Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows Automatic updates not working - Microsoft Community
1- Stop the update service. Run these commands in command prompt (Admin):. net stop bits · 2- Clear the windows update cache. Delete...
Read more >
Full Fix: Windows 10/11 automatic update problems
Automatic update problems on Windows 10, how to fix them? · 1. Change Windows Update settings · 2. Check your antivirus · 3....
Read more >
7 Solutions to Fix Windows 10 Won't Update. #6 Is Fantastic
Why Windows 10 Won't Update; Remove Third-party Security Software; Check Windows Update Utility Manually; Keep All Services about Windows Update ...
Read more >
How to Enable Auto-Updates in Windows 10 | The InfoSec Blog
From Settings, tap or click on Update & security. Choose Windows Update from the menu on the left, assuming it's not already selected....
Read more >
Windows Update Not Working for Your Latest Upgrade ...
Windows Update not working for your latest upgrade? Here's how to fix it · Manage automatic updates · Windows 10 Update Change Active...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found