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 11 years ago
- Reactions: 9
- Comments: 28 (6 by maintainers)
You can’t call
checkForUpdatesunless you’re an installed appCall that method and see if it throws 😃
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.
It’s 2024, and I also encountered this problem. How did everyone solve it?
The canonical way to detect if you are a Squirrel-installed app if you’re not into that is:
You can only trigger the
checkForUpdatesfrom the installed location. Squirrel barfs when you try triggering the checkForUpdates from the source-code…Also, you’ll need to run the
update.exefile from command-line, notelectron.Lol, was thinking of doing that as a last resort. Seems like it is the first resort 😝
I had the same issue with the autoUpdater of Electron.
From the documentation of Electron builder it seems that the Squirrel is maintain but deprecated. “Squirrel.Windows target is maintained, but deprecated. Please use nsis instead. electron builder”
In my case, I used NX-Electron, who did a template of autoUpdater with Electron which under the hood, use the Squirrel implementation. I didn’t succeed to make it work with Squirrel. A change the implementation to electron-updater, change the import autoUpdater from Electron to Electron-Updater package : electon updater
import { autoUpdater } from "electron-updater"Follow the website and don’t forget to add some details in the package.json to make it work ( like a publish properties ) It works like a charm !
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 ?