Upgrades are based on applications distributed using installation packages. This does not apply to green install-free versions (mainly Windows Portable versions).
Electron comes with an upgrade framework
advantages
- Contains versioning logic and callbacks
- The logic of download, installation and upgrade is realized
disadvantages
- Release qualified server (GitHub)
- It’s a full update every time
Electron – Builder’s upgrade framework
advantages
- Contains versioning logic and callbacks
- The logic of download, installation and upgrade is realized
- Support for multiple versions of servers, including self-built “universal servers”
- Support alpha/beta/latest version update strategy
- Support grayscale publishing (by percentage of users)
- Support for incremental updates, implementing the policy of switching to full updates when incremental updates fail (currently only for Windows, the project team reportedly plans to add incremental updates for MAC)
- Support for automatic release of builds to the server
- * Support for downgrading updates
disadvantages
- The version update check is based on the value of the Version field in package.json, which only supports the three-part version number and cannot be customized. See SMERV for specific rules
Q&A
[error] Cannot download differentially, fallback to full download: error: Cannot parse blockmap XXXXXX, error: XXXXXX
An error occurs when the Blockmap file is uploaded to the server. Rectify the fault according to the error information. Most likely, the blockMap file will fail when unzipping, and the log will look something like this:
Cannot download differentially, fallback to full download: Error: Cannot parse blockmap "https://api.github.com/repos/VitruxPT/w-assistant/releases/assets/18470277.blockmap", error: incorrect header check, raw data:...
Copy the code
Blockmap files are compiled, so if there is no file corruption when uploading to the server, there must be a compile-time problem. Maybe the local versions of electron-builde and electron-updater are too low. Please make sure the electric-Builder is above 22.8.0 and the electric-updater is 4.3.4. Because there was a bug in previous versions of blockMap file generation, you can check the github page of the project for details.
- The server does not return the BLOCKMap MIME-type, resulting in a parse error
Blockmap Specifies the MIME-type of the file suffix: multipart/byteranges
About the green install-free version of the upgrade
In fact, it is not completely impossible, in addition to the conventional implementation of a set of inspection logic, in fact, the electron-updater can also be done:
- Create your own latest.yml(alpha/beta is the same, but the specific channel value is different) for the upgrade check and put it on the server with the corresponding new version exe file
- Prompt the user to upgrade in the electron-updater version update check callback
- When the download is complete, the user is required to select a directory for storing the new version, and the user is reminded that the new version can only be run using the EXE file in the directory of their choice
- After the user selects a directory, the exe downloaded from the electron-updater upgrade cache directory is moved to the directory selected by the user
Pay attention to
Due to the limitation of the green installation-free version mechanism, the upgrade can only be a full upgrade (replacing the EXE file), and incremental update cannot be performed