megahertz/electron-simple-updater

can not get update!

Closed this issue · 18 comments

I publish an app with version 1.0.4 in package.json, when I use electron-simple-updater, I make the updates.json like:
{
"win32-x64-prod": {
"readme": "日常更新",
"update": "https://xxxx/worker-management/1520414279",
"install": "https://xxxx/worker-management/1520414279/%E4%BC%8A%E4%BA%91%E4%BB%93TEM%20Setup%201.0.5.exe",
"version": "1.0.5"
}
}

I run this script to pack:
"pack:win": "electron-builder --win --ia32"
my update url is
"updater": { "url": "http://xxxx/worker-management/raw/master/updates.json?private_token=xxxx" }

in main.js

updater.init({
checkUpdateOnStart: false,
autoDownload: false
})

in render.js:

import { remote } from 'electron'
export default function update() {
const updater = remote.require('electron-simple-updater')
updater.on('update-available', meta => {
console.log('[updater] update avaiable', meta.version)
updater.downloadUpdate()
})
updater.on('update-not-available', () => {
console.log('there is no available update')
})
updater.on('update-downloading', () => {})
updater.on('update-downloaded', () => {
if (window.confirm('Restart and install updates?')) {
updater.quitAndInstall()
}
})
updater.on('error', err => {
console.warn(err)
})
updater.checkForUpdates()
}

I always got 'there is no available update'.
What is wrong with my case?

  1. Make sure that you 1.0.5 is published successfully (with exact version 1.0.5 in package.json)
  2. Make sure that you run 1.0.4 to test updates (also, with exact version 1.0.4 in package.json)
  3. Show application logs (run compiled app from console or use electron-log instead of console.log)

@megahertz I have uploaded three file like:
image

@megahertz I get the error "Can not find Squirrel", but I do not find some ways to fix it. Can you help?

@megahertz I saw this issue, but I do not know how to fix it

@megahertz
"updater": {
"url": "http://xxxxxx/-worker-management/raw/master/updates.json?private_token=xxxxx"
},
"build": {
"productName": "伊云仓TEM",
"appId": "com.worker-management",
"directories": {
"output": "package"
},
"files": [
"dist/production/",
"node_modules/",
"package.json",
"index.js",
"index.html"
],
"dmg": {
"contents": [
{
"x": 410,
"y": 150,
"type": "link",
"path": "/Applications"
},
{
"x": 130,
"y": 150,
"type": "file"
}
]
},
"mac": {
"icon": "src/assets/icons/icon.icns",
"category": "public.app-category.utilities",
"target": [
"dmg"
]
},
"win": {
"icon": "src/assets/icons/icon.ico",
"target": [
"nsis",
"squirrel"
]
},
"squirrelWindows": {
"iconUrl": "https://xxxx/uploads/icon.ico"
}
}

I can not see what is the problem with my config

@megahertz the error like that:
image
image

First of all, disable nsis and rebuild the application for both 1.0.4 and 1.0.5

@megahertz thank you so much! I added the "nsis" option because I though that user must install the app(producted by nsis) at the first time, but it is not.

@megahertz It was successfully when I installed 1.0.0 and I updated to 1.0.1, but I got error when I tried to update to 1.0.2.

Error: Command failed: 4294967295
System.AggregateException: ����һ���������� ---> System.Exception: Checksummed file size doesn't match: C:\Users\ERP\AppData\Local\worker-management\packages\worker-management-1.0.12-full.nupkg
�� Squirrel.UpdateManager.DownloadReleasesImpl.checksumPackage(ReleaseEntry downloadedRelease)
�� Squirrel.UpdateManager.DownloadReleasesImpl.<>c__DisplayClass2_0.<b__1>d.MoveNext()
--- �����쳣����һλ���ж�ջ���ٵ�ĩβ ---
�� System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
�� System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
�� Squirrel.Utility.<>c__DisplayClass13_01.<<ForEachAsync>b__1>d.MoveNext() --- �����쳣����һλ���ж�ջ���ٵ�ĩβ --- �� System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) �� System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) �� Squirrel.UpdateManager.DownloadReleasesImpl.<DownloadReleases>d__2.MoveNext() --- �����쳣����һλ���ж�ջ���ٵ�ĩβ --- �� System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) �� System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) �� Squirrel.UpdateManager.<DownloadReleases>d__8.MoveNext() --- �����쳣����һλ���ж�ջ���ٵ�ĩβ --- �� System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) �� System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) �� Squirrel.Update.Program.<Update>d__5.MoveNext() --- �ڲ��쳣��ջ���ٵĽ�β --- �� System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) �� System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) �� System.Threading.Tasks.Task.Wait() �� Squirrel.Update.Program.executeCommandLine(String[] args) �� Squirrel.Update.Program.main(String[] args) �� Squirrel.Update.Program.Main(String[] args) ---> (�ڲ��쳣 #0) System.Exception: Checksummed file size doesn't match: C:\Users\ERP\AppData\Local\worker-management\packages\worker-management-1.0.12-full.nupkg �� Squirrel.UpdateManager.DownloadReleasesImpl.checksumPackage(ReleaseEntry downloadedRelease) �� Squirrel.UpdateManager.DownloadReleasesImpl.<>c__DisplayClass2_0.<<DownloadReleases>b__1>d.MoveNext() --- �����쳣����һλ���ж�ջ���ٵ�ĩβ --- �� System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) �� System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) �� Squirrel.Utility.<>c__DisplayClass13_01.<b__1>d.MoveNext()
--- �����쳣����һλ���ж�ջ���ٵ�ĩβ ---
�� System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
�� System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
�� Squirrel.UpdateManager.DownloadReleasesImpl.d__2.MoveNext()
--- �����쳣����һλ���ж�ջ���ٵ�ĩβ ---
�� System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
�� System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
�� Squirrel.UpdateManager.d__8.MoveNext()
--- �����쳣����һλ���ж�ջ���ٵ�ĩβ ---
�� System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
�� System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
�� Squirrel.Update.Program.d__5.MoveNext()<---

at AutoUpdater.emitError (C:\Users\ERP\AppData\Local\worker-management\app-1.0.11\resources\electron.asar\browser\api\auto-updater\auto-updater-win.js:58:24)
at squirrelUpdate.update (C:\Users\ERP\AppData\Local\worker-management\app-1.0.11\resources\electron.asar\browser\api\auto-updater\auto-updater-win.js:43:23)
at ChildProcess.<anonymous> (C:\Users\ERP\AppData\Local\worker-management\app-1.0.11\resources\electron.asar\browser\api\auto-updater\squirrel-update-win.js:71:14)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)

It seems that your build is corrupted.

i using windows target as portable.... cannot find squirrel?? does it work with portable???
it tried "squirrel" but i faced the issue below...
TypeError: packager.info.callArtifactBuildStarted is not a function

@Crazie-ash No it doesn't works with portable build. electron-userland/electron-builder#3508

it doesn't work with squirrel and zip target - while building TypeError: packager.info.callArtifactBuildStarted is not a function
then i tried with nsis target - it throwed this Error: Can not find Squirrel... i don't know what i am missing!!!

{
"keywords": [
"angular",
"angular 7",
"electron",
"typescript",
"sass"
],
"main": "main.js",
"private": true,
"files": [
"!README.md",
"!updates.json"
],
"scripts": {
"postinstall": "npm run postinstall:electron && electron-builder install-app-deps",
"postinstall:web": "node postinstall-web",
"postinstall:electron": "node postinstall",
"ng": "ng",
"start": "npm run postinstall:electron && npm-run-all -p ng:serve electron:serve",
"build": "npm run postinstall:electron && npm run electron:serve-tsc && ng build",
"build:dev": "npm run build -- -c dev",
"build:prod": "npm run build -- -c production",
"ng:serve": "ng serve",
"ng:serve:web": "npm run postinstall:web && ng serve -o",
"electron:serve-tsc": "tsc -p tsconfig-serve.json",
"electron:serve": "wait-on http-get://localhost:4200/ && npm run electron:serve-tsc && electron . --serve",
"electron:local": "npm run build:prod && electron .",
"electron:linux": "npm run build:prod && electron-builder build --linux --ia32 --x64 --armv7l",
"electron:windows": "npm run build:prod && electron-builder build --windows",
"electron:mac": "npm run build:prod && electron-builder build --mac",
"test": "npm run postinstall:web && ng test",
"e2e": "npm run postinstall:web && ng e2e",
"version": "conventional-changelog -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md"
},
"dependencies": {
"@angular/animations": "^7.2.4",
"@angular/cdk": "^7.3.0",
"@angular/core": "^7.1.4",
"@angular/material": "^7.3.0",
"@angular/router": "^7.1.4",
"auto-launch": "^5.0.5",
"delay": "^4.2.0",
"desktop-idle": "^1.1.2",
"electron-builder-squirrel-windows": "^20.40.0",
"electron-log": "^3.0.5",
"electron-notifications": "^1.0.0",
"electron-positioner": "^4.1.0",
"electron-process-manager": "^0.7.0",
"electron-simple-updater": "^1.5.0",
"electron-store": "^3.1.0",
"electron-updater": "^4.0.6",
"is-online": "^8.1.0",
"ngx-toastr": "^9.1.2",
"parse": "1.11.1",
"run-electron": "^0.1.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.11.4",
"@angular/cli": "7.1.4",
"@angular/common": "7.1.4",
"@angular/compiler": "7.1.4",
"@angular/compiler-cli": "7.1.4",
"@angular/core": "7.1.4",
"@angular/forms": "7.1.4",
"@angular/http": "7.1.4",
"@angular/language-service": "7.1.4",
"@angular/platform-browser": "7.1.4",
"@angular/platform-browser-dynamic": "7.1.4",
"@angular/router": "7.1.4",
"@ngx-translate/core": "11.0.1",
"@ngx-translate/http-loader": "4.0.0",
"@types/jasmine": "2.8.7",
"@types/jasminewd2": "2.0.3",
"@types/node": "8.9.4",
"codelyzer": "4.5.0",
"conventional-changelog-cli": "2.0.11",
"core-js": "2.6.1",
"electron": "^4.0.8",
"electron-builder": "20.36.2",
"electron-reload": "1.3.0",
"electron-simple-publisher": "^0.6.2",
"jasmine-core": "3.3.0",
"jasmine-spec-reporter": "4.2.1",
"karma": "3.1.1",
"karma-chrome-launcher": "2.2.0",
"karma-coverage-istanbul-reporter": "2.0.4",
"karma-jasmine": "2.0.1",
"karma-jasmine-html-reporter": "1.4.0",
"npm-run-all": "4.1.5",
"primeicons": "^1.0.0",
"primeng": "^6.1.7",
"protractor": "5.4.1",
"rxjs": "6.3.3",
"ts-node": "7.0.1",
"tslint": "5.11.0",
"typescript": "3.1.6",
"wait-on": "3.2.0",
"webdriver-manager": "12.1.0",
"zone.js": "0.8.26"
}
}

@Crazie-ash I think electron-builder and electron-builder-squirrel-windows should have the same version. Anyway, I can't help you too much with the build problem.

As u said i tried using the same version. it worked well but i am still facing this Error: Can not find Squirrel

I am using the following
updates.json
{
"win32-x64-prod": {
"update": "http://"myip"/bbUpdate/windows/exe",
"install": "http://"myip"/bbUpdate/windows/exe/appSetup1.0.1.exe",
"version": "1.0.1"
}
}

package.json
"electron-builder-squirrel-windows": "20.39.0",
"electron-builder": "20.39.0",

electron-builder.json
"win": {
"icon": "dist/assets/favicon.256x256.png",
"target": [
"squirrel",
"zip"
]},
"squirrelWindows": {
"iconUrl": "https://raw.githubusercontent.com/megahertz/electron-simple-updater/master/example/build/icon.ico"
},

update path folder "/bbUpdate/windows/exe/" contains the following

app-1.0.1-win.zip
appSetup1.0.1.exe
appSetup1.0.1.nupkg
builder-effective-config.yaml
RELEASES

@Crazie-ash You can see such a message only when you run non squirrel build.