electron: autoUpdater.checkForUpdates() throws "Can not find Squirrel"

I’m trying to get autoUpdater working in my app, and when I call ‘checkForUpdates’, it just throws this error:

Error: Can not find Squirrel
    at AutoUpdater.emitError (D:\Workspace\myApp\node_modules\electron-prebuilt\dist\resources\atom.asar\browser\api\lib\auto-updater\auto-updater-win.js:58:31)
    at AutoUpdater.checkForUpdates (D:\Workspace\myApp\node_modules\electron-prebuilt\dist\resources\atom.asar\browser\api\lib\auto-updater\auto-updater-win.js:26:19)
    at Object.<anonymous> (D:\Workspace\myApp\main.js:28:15)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Object.<anonymous> (D:\Workspace\myApp\node_modules\electron-prebuilt\dist\resources\default_app\main.js:258:23)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 9
  • Comments: 25 (6 by maintainers)

Most upvoted comments

Call that method and see if it throws 😃

You can’t call checkForUpdates unless you’re an installed app

What is installed app? I packaged my app and install it. But Can not find squirrel errer is…re-occured. What should I do?

I just ran into this issue with my electron app.

The app is packaged using electron-builder and is installed on windows, but throws the error “Can not find Squirrel” when it checks for updates on Windows. It works find on Mac.

Every thread I can find says the issue is related to the app not being installed, but the app is definitely installed.

The canonical way to detect if you are a Squirrel-installed app if you’re not into that is:

fs.existsSync(path.resolve(path.dirname(process.execPath), '..', 'update.exe'));

You can only trigger the checkForUpdates from the installed location. Squirrel barfs when you try triggering the checkForUpdates from the source-code…

Also, you’ll need to run the update.exe file from command-line, not electron.

Lol, was thinking of doing that as a last resort. Seems like it is the first resort 😝

It’s 2024, and I also encountered this problem. How did everyone solve it?

Yes. I used grunt-electron-installer to make my setup.exe file, which I believe uses Squirrel.Windows. The setup.exe got put in the same directory as the setup.msi, nupkg, and RELEASES files, and started up with the pretty animation and made a new entry to my programs and features, so I’m sure it executed correctly.

@paulcbetts @kumarharsh when you say installed app, does that mean it must be run through a windows installer? I can find my app in “Programs and Features” after running my setup.exe, so it’s installed but I guess it’s not Squirrel-installed ?