Windows: auto update should remove binary after install/relaunch
See original GitHub issue- Version: 19.48.3
- Target: Win32
This problem may be specific to NSIS.
After performing an auto-update, the AppData/Roaming directory contains the .exe that was used to perform the update. After each version update, a new binary continues to live there, increasing the “bloat” of the application significantly. There are methods for an app to “clean up” after an update and delete these files, but this seems like it should be default behavior for the updater.
Here’s my package.json (with some redactions):
{
"name": "wildlink",
"productName": "Wildlink",
"description": "foo",
"version": "1.2.8",
"main": "./app/main.js",
"license": "UNLICENSED",
"author": "Wildfire Systems, Inc. <info@wildlink.me>",
"homepage": "https://wildlink.me",
"scripts": {
"start": "electron . --enable-logging",
"testmacpartner": "electron . --enabled-logging -channel=$channelID",
"dev": "NODE_ENV='development' ELECTRON_ENABLE_STACK_DUMPING=true ELECTRON_ENABLE_LOGGING=true npm run start",
"postinstall": "electron-builder install-app-deps",
"pack": "build --dir",
"build:linux": "build --linux",
"build:win": "build --win",
"build:mac": "build --dmg",
"build:all": "build --linux --win",
"dist": "build"
},
"build": {
"appId": "wildlink",
"publish": [
{
"provider": "generic",
"url": "https://wildlink.me/desktop-update"
}
],
"dmg": {
"internetEnabled": true,
"background": "./build/background.png",
"iconSize": 85,
"window": {
"width": 417,
"height": 213
},
"contents": [
{
"x": 106,
"y": 84
},
{
"x": 307,
"y": 84,
"type": "link",
"path": "/Applications"
}
]
},
"linux": {
"target": [
"deb"
],
"category": "Utility"
},
"win": {
"target": {
"target": "NSIS",
"arch": [
"ia32"
]
},
"icon": "build/icon.ico"
}
},
"repository": {
"type": "git",
"url": "xxx"
},
"bugs": {
"url": "xxx"
},
"devDependencies": {
"electron": "^1.8.4",
"electron-builder": "19.48.3",
"electron-packager": "^7.3.0",
"electron-reload": "^1.2.2",
"electron-toolkit": "^1.0.24",
"electron-winstaller": "^2.6.4"
},
"dependencies": {
"chart.js": "^2.7.2",
"crypto-js": "^3.1.9-1",
"electron-contextmenu-middleware": "^1.0.3",
"electron-input-menu": "^2.1.0",
"electron-json-storage": "^4.1.0",
"electron-log": "^2.2.14",
"electron-push-receiver": "^1.2.4",
"electron-updater": "2.21.6",
"first-run": "1.2.0",
"localforage": "^1.7.1",
"path": "^0.12.7",
"request": "^2.85.0",
"universal-analytics": "^0.4.16",
"utf8": "^2.1.2",
"winreg": "^1.2.4"
}
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:10 (7 by maintainers)
Top Results From Across the Web
How to install multiple Windows updates or hotfixes with only ...
To install multiple updates with only one restart · Run the update installer with the -z switch to instruct the installer not to...
Read more >Policy CSP - Update - Windows Client Management
1: Auto install the update and then notify the user to schedule a device restart. Updates are downloaded automatically on non-metered networks ...
Read more >Step 4 - Configure Group Policy Settings for Automatic Updates
Specifies whether Automatic Updates will automatically install updates that don't interrupt Windows services or restart Windows.
Read more >Manage device restarts after updates (Windows 10)
Registry keys used to manage restart · 1: enable automatic reboot after update installation at a scheduled time · 2: notify for download...
Read more >How to stop automatic updates on Windows 10
You do not need to disable Windows Update permanently if you want to prevent the system from downloading a specific update immediately. Instead, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
__installer.exe
is always in your app data.__update__
till first update check that returns “no available update”.@CydeSwype Until electron builder comes with some inbuilt solution. We can do below code in our application. I have achieved this as below.
Step 1 Save file path and version of the newly downloaded file to DB or somewhere in a file as JSON Object.
Step 2 Check current app version with the saved JSON when app starts (createWindow). If we found app version same as version saved in json then we can remove previously downloaded installer as that installer is already installed.
Note :- Currently above code removes only latest downloaded installer. All previous installers are not being removed if more than one installer has been downloaded. For Ex:- if your app is running on 1.0.0. You release new version 1.2.0 then it will be downloaded. It may or may not install instantly as per your configuration. Now suppose that new update is not installed and you release new version 1.4.0 then 1.4.0 will be downloaded. Now if you install 1.4.0 then installer-1.4.0 will be removed after installation but installer-1.2.0 will remain as it is. You can remove that as well by keeping every downloaded installer information as array in JSON and can loop thorugh it under
creatwindow()
.Hope this solve your issue 🙂