title: electron auto-update for windows
body: <p>I am trying to create an electron app that will auto-update new releases from github. Trying to do this for mac and windows right now.</p>
  <p>I have been able to successfully create and sign a mac os .dmg programs by following <a href="https://medium.com/@johndyer24/creating-and-deploying-an-auto-updating-electron-app-for-mac-and-windows-using-electron-builder-6a3982c0cee6" rel="nofollow noreferrer">this tutorial</a>. The result is an electron app that when I am on my mac laptop and run <code>npm run deploy</code> for a new version, it will build and package the program by running this command: <code>electron-builder build --mac --win --publish always</code></p>
  <p>The mac os .dmg file works like the tutorial instructs, it checks for updates in my main.js file and if a new version is published it will prompt the user to restart the app.</p>
  <p>The tutorial is supposed to also work for windows, but the windows.exe that gets generated and upload to my github repo releases tab does not seem to auto-update. I test this by running my app windows portable .exe file: <code>electron-auto-updater-1.0.2</code> after I have already released v1.0.3, so it should autoupdate but never does, and doesnt throw any err in my electron app window console.</p>
  <p>Do I need to sign my windows exe for electron in a different way? Ultimately I am trying to create a bare minimum electron app for windows 10 with auto-updating. I have been looking online and following various old tutorial blog posts, the one i linked seems like the most recent (2019), and I followed every instruction for the signing procedure on a mac os laptop, but my code is not working on windows:</p>
  <p><strong>package.json</strong></p>
  <pre><code>{
    &quot;name&quot;: &quot;electron-auto-updater&quot;,
    &quot;productName&quot;: &quot;Electron tutorial app&quot;,
    &quot;description&quot;: &quot;Application for electron tutorials&quot;,
    &quot;version&quot;: &quot;1.0.4&quot;,
    &quot;main&quot;: &quot;main.js&quot;,
    &quot;scripts&quot;: {
      &quot;start&quot;: &quot;electron .&quot;,
      &quot;build&quot;: &quot;electron-builder build --mac --win --publish never&quot;,
      &quot;deploy&quot;: &quot;electron-builder build --mac --win --publish always&quot;,
      &quot;deploy-win&quot;: &quot;electron-builder build --win --publish always&quot;,
      &quot;build-win&quot;: &quot;electron-builder build --win --publish never&quot;
    },
    &quot;build&quot;: {
      &quot;appId&quot;: &quot;yourAppId&quot;,
      &quot;afterSign&quot;: &quot;scripts/notarize.js&quot;,
      &quot;mac&quot;: {
        &quot;icon&quot;: &quot;build/icon.png&quot;,
        &quot;hardenedRuntime&quot;: true,
        &quot;gatekeeperAssess&quot;: false,
        &quot;entitlements&quot;: &quot;build/entitlements.mac.plist&quot;,
        &quot;entitlementsInherit&quot;: &quot;build/entitlements.mac.plist&quot;,
        &quot;target&quot;: [
          &quot;dmg&quot;,
          &quot;zip&quot;
        ]
      },
      &quot;dmg&quot;: {
        &quot;sign&quot;: false
      },
      &quot;linux&quot;: {
        &quot;category&quot;: &quot;TODO: fill here the category of your app&quot;,
        &quot;icon&quot;: &quot;build/icon.png&quot;,
        &quot;target&quot;: [
          &quot;AppImage&quot;,
          &quot;deb&quot;
        ]
      },
      &quot;win&quot;: {
        &quot;target&quot;: &quot;portable&quot;,
        &quot;icon&quot;: &quot;build/icon.png&quot;
      }
    },
    &quot;author&quot;: &quot;&quot;,
    &quot;license&quot;: &quot;ISC&quot;,
    &quot;devDependencies&quot;: {
      &quot;electron&quot;: &quot;^11.0.3&quot;,
      &quot;electron-builder&quot;: &quot;^22.9.1&quot;,
      &quot;electron-notarize&quot;: &quot;^1.0.0&quot;,
      &quot;electron-winstaller&quot;: &quot;^4.0.1&quot;
    },
    &quot;dependencies&quot;: {
      &quot;dotenv&quot;: &quot;^8.2.0&quot;,
      &quot;electron-updater&quot;: &quot;^4.3.5&quot;
    },
    &quot;repository&quot;: {
      &quot;type&quot;: &quot;git&quot;,
      &quot;url&quot;: &quot;https://github.com/MartinBarker/electron-auto-updater.git&quot;
    }
  }
  
  </code></pre>
  <p><strong>main.js</strong></p>
  <pre><code>const { app, BrowserWindow, ipcMain } = require('electron');
  const { autoUpdater } = require('electron-updater');
  require('dotenv').config();
  
  let mainWindow;
  
  function createWindow () {
    mainWindow = new BrowserWindow({
      width: 800,
      height: 600,
      webPreferences: {
        nodeIntegration: true,
      },
    });
    mainWindow.loadFile('index.html');
    mainWindow.on('closed', function () {
      mainWindow = null;
    });
  
    mainWindow.once('ready-to-show', () =&gt; {
      try{
        autoUpdater.checkForUpdatesAndNotify();
      }catch(err){
        console.log('autoUpdater.checkForUpdatesAndNotify(); err = ', err)
      }
    });
  }
  
  app.on('ready', () =&gt; {
    createWindow();
  });
  
  app.on('window-all-closed', function () {
    if (process.platform !== 'darwin') {
      app.quit();
    }
  });
  
  app.on('activate', function () {
    if (mainWindow === null) {
      createWindow();
    }
  });
  
  ipcMain.on('app_version', (event) =&gt; {
    event.sender.send('app_version', { version: app.getVersion() });
  });
  
  ipcMain.on('restart_app', () =&gt; {
      autoUpdater.quitAndInstall();
    });
  
  autoUpdater.on('update-available', () =&gt; {
      mainWindow.webContents.send('update_available');
      console.log('update avail')
    });
    autoUpdater.on('update-downloaded', () =&gt; {
      console.log('update downlaoded')
      mainWindow.webContents.send('update_downloaded');
    });
  
  If I build on command prompt on my wind 10 computer I get this output in ym console: no error messages:
  
  </code></pre>
  <pre><code>$1.0.4 deploy-win C:\Users\marti\Documents\projects\electron-auto-updater
  electron-builder build --win --publish always
  
  electron-builder  version=22.9.1 os=10.0.18363
  loaded configuration  file=package.json (&quot;build&quot; field)
  writing effective config  file=dist\builder-effective-config.yaml
  packaging       platform=win32 arch=x64 electron=11.0.3     appOutDir=dist\win-unpacked
  building        target=portable file=dist\Electron tutorial app 1.0.4.exe archs=x64
  </code></pre>
  <pre><code>  s
  </code></pre>