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

autoUpdater.quitAndInstall() not working on M1 Mac, works on Intel Mac #8178

Open
npaul007 opened this issue Apr 19, 2024 · 1 comment
Open

Comments

@npaul007
Copy link

  • Electron-Builder Version: 24.12.0
  • Node Version: v21.6.2
  • Electron Version: 29.0.1
  • Electron Type (current, beta, nightly): current
  • Which version of electron-updater are you using (if applicable)?: 6.1.8
  • Target: zip

What operating system are you using?

macOS

Operating System Version

MacOS Monterrey 12.0.1

What arch are you using?

arm64 (including Apple Silicon)

Expected Behavior

Desktop application closes upon confirmation of Restart, Installs software update and reboots application

Actual Behavior

Application closes and never relaunches. The dot is present below the app in the dock

Currently using a self-hosted static server to download new software versions.

src/main/index.js

// on the update being downloaded, ask user if they'd like to update
autoUpdater.on("update-downloaded", (info) => {
  const dialogOpts = {
    type: "info",
    buttons: ["Restart", "Cancel"],
    title: "Application Update",
    detail:
      "A new version has been downloaded. Restart the application to apply the updates.",
  };

  dialog
    .showMessageBox(dialogOpts)
    .then((response) => {
      if (response.response === 0) {
        setImmediate(() => {
          app.removeAllListeners("window-all-closed");

          const browserWindows = BrowserWindow.getAllWindows();
          browserWindows.forEach((browserWindow) => {
            browserWindow.close(); // Close all windows
          });

          autoUpdater.quitAndInstall();
        });
      }
    })
    .catch((err) => console.log(err));
});

electron-builder.config.js

module.exports = {
  appId: "com.organization.myapp",
  productName: "MyApp",
  asar: true,
  asarUnpack: ["resources/**"],
  directories: {
    output: "dist/${version}",
  },
  electronLanguages: "en-US",
  files: [
    "!**/.vscode/*",
    "!*.code-workspace",
    "!src/*",
    "!build/*",
    "!tests/*",
    "!public/*",
    "!osp/*",
    "!electron.vite.config.{js,ts,mjs,cjs}",
    "!electron-builder.{js,ts,mjs,cjs,json}",
    "!{.eslintignore,.eslintrc.cjs,.eslintrc.js,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}",
    "!{.env,.env.*,.npmrc,pnpm-lock.yaml}",
    "!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}",
    "!{apidoc.json,playwright.config.ts}",
  ],
  win: {
    target: [
      {
        target: "nsis",
        arch: ["x64"],
      },
    ],
    artifactName: "${productName}_Setup_(${version}).${ext}",
    extraResources: [
      {
        filter: ["resource"],
      },
    ],
    icon: "build/icons/win/icon.ico",
  },
  nsis: {
    oneClick: false,
    createDesktopShortcut: true,
    createStartMenuShortcut: true,
    allowToChangeInstallationDirectory: true,
    perMachine: true,
    deleteAppDataOnUninstall: false,
    include: "build/scripts/installer.nsh",
    runAfterFinish: true,
    license: "build/documents/LicenseFile.rtf",
  },
  mac: {
    target: "zip",
    asarUnpack: ["Resources/**"],
    icon: "build/icons/mac/icon.icns",
    artifactName: "${productName}_Setup_(${version}).${ext}",
    extraResources: [
      {
        filter: ["osp/osp.app/**"],
      },
    ],
    publish: {
      provider: "generic",
      url: "http://localhost:3030/",
    },
  },
  linux: {
    target: ["AppImage"],
    icon: "build/icons/mac/icon.icns",
    category: "AudioVideo",
    artifactName: "${productName}_Setup_(${version}).${ext}",
    extraResources: [
      // If it ever gets created, Linux OSP would go here
    ],
  },
};

I must also mention the app is not signed - I wonder if that may be contributing to the issues being faced.

@slhck
Copy link
Contributor

slhck commented May 2, 2024

"the app is not signed" -- yeah you have to sign it. This is listed at the very top of https://www.electron.build/auto-update.html

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

No branches or pull requests

2 participants