Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoupdate downloads new update, but does not successfully update the app on quit. #2317

Closed
moughxyz opened this issue Nov 21, 2017 · 53 comments

Comments

@moughxyz
Copy link

(This is a follow up on #2006 (comment))

Unfortunately I am still seeing this issue with electron-builder 19.45.5 and electron 1.7.9.

I'm not sure if the underlying cause is the same, but on the surface, here's what happens:

  1. Open Mac app, receive update-downloaded event.
  2. Instruct user to quit app and re-open to install update.
  3. User quits app, and re-opens immediately.

Result:

  • App is not upgraded. update-downloaded is received again. Repeat steps 1-3, same results.

After repeating many times, it will eventually update.

Any ideas as what could be causing this? Does user have to wait X seconds after quitting app before re-opening?

My index.js: https://github.com/standardnotes/desktop/blob/master/app/index.js#L29

You can test this issue for yourself by downloading an older version of Standard Notes and waiting for the update message to appear in the lower right corner of the app: https://github.com/standardnotes/desktop/releases

@MarkusBansky
Copy link

Got exactly the same issue. Not sure about several updates, but my app is not updating itself after successfully downloading from server and restarting on quitAndInstall()

@sProject
Copy link

sProject commented Nov 24, 2017

Thank God this issue, I thought I'm going insane 😄 I have the exact same issue. My goal was to get to learn how to do publishing by forking one of the example projects and following the documentation. You can see my releases from yesterday on github, I got that part working. However, my ultimate goal is to get auto update staged rollouts integrated as part of my production aws codepipeline, which is going to be publishing to S3.

So this is my setup

  • Oracle vBox running fedora 27
  • my project is a fork of this sample project, taken from the oficial documentation for auto-update.
  • the only way to get the publishing working with github is electron-builder --x64 --linux from (this youtube video)[https://www.youtube.com/watch?v=_Hnzuko2eAc]. I'm unable to get the build object in package.json right for linux :\ it always gives me errors, despite my best effort of following and re-reading the documentation.

I noticed 2 things while getting publishing to work. The first is to do with the publishing process itself. As you can see in the log below I have permission denied error. Even though this error, I get a successfully published artifacts. This is something that always happens and I don't know what is trying to do and how to fix it.

[fedora@localhost electron-updater-example]$ yarn pub
yarn run v1.3.2
$ electron-builder --x64 --linux -p always
electron-builder 19.46.4
No native production dependencies
Packaging for linux x64 using electron 1.7.9 to dist/linux-unpacked
Building AppImage for arch x64
⚠️  Application icon is not set, default Electron icon will be used
⚠️  Application category is not set for Linux (linux.category).
Please see https://electron.build/configuration/configuration#LinuxBuildOptions-category
Publishing to Github (owner: sProject, project: electron-updater-example, version: 0.9.72)
Release with tag v0.9.72 doesn't exist, creating one
[====================] 100% 0.0s | app-0.9.72-x86_64.AppImage to GitHub
Cannot delete temporary "/tmp": Error: EACCES: permission denied, rmdir '/tmp'
    at default.each.then (/home/fedora/intouch/electron-updater-example/node_modules/temp-file/src/main.ts:63:19)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
    at callback (/home/fedora/intouch/electron-updater-example/node_modules/temp-file/src/main.ts:63:8)
    at runHook (/home/fedora/intouch/electron-updater-example/node_modules/async-exit-hook/index.js:48:11)
    at Array.map (<anonymous>)
    at exit (/home/fedora/intouch/electron-updater-example/node_modules/async-exit-hook/index.js:71:8)
    at process.events.(anonymous function) (/home/fedora/intouch/electron-updater-example/node_modules/async-exit-hook/index.js:116:3)
    at emitOne (events.js:116:13)
    at process.emit (events.js:211:7)
    at process.emit (/home/fedora/intouch/electron-updater-example/node_modules/source-map-support/source-map-support.js:439:21)
Done in 39.79s.
[fedora@localhost electron-updater-example]$

The second observation I had is that some of the events for auto update may not be triggering. Case in point is autoUpdater.on('download-progress', (progressObj) => {}). You can see what I mean if you download v0.9.7. The app is going to correctly pick up that there is an update (displaying a message "Update available"). Then download-progress is not fired and if you wait a few moments you'll see update-downloaded firing and I've configured it to setTimeout(() => autoUpdater.quitAndInstall(), 5000). At that point the app is not restarted - it simply quits. If you start it again it does the exact same thing all over again. Also I tried to figure out where the new release file is supposed to be downloaded - no luck and I don't see it in the docs.

On a side note: I love electron and I believe that it is the future of developing desktop software. I'm new-ish to electron, I've been using it for the past 4 months, and now I want to become more proficient and use electron-builder in production. However, I felt the last few days a bit under supported even with the great efforts you guys have put in the documentation. So I think I can help you by documenting my experience and passing it on to you as a detailed tutorial, for people that have the same setup as me. Let me know if you are interested.

@siebertm
Copy link

siebertm commented Dec 5, 2017

I might have a hint on what might happen, I believe it might be a race condition, but I don't have enough experience with nodejs to proof that.

AppImageUpdater#doInstall uses fs-extra-p to move() and chmod() the downloaded file. Now, I tracked the calls to a point where move() is called, but the returned Promise is never even resolved.

This might be due to BaseUpdater#quitAndInstall() immediately (synchronously) quitting the application.
When I comment out https://github.com/electron-userland/electron-builder/blob/master/packages/electron-updater/src/BaseUpdater.ts#L21, it works (almost)

Then I found another (clear) bug: When we run files with a version number in their name (e.g. app-v1.0.AppImage), doInstall sets APPIMAGE_DELETE_OLD_FILE and moves the file to app-v1.1.AppImage. Later it tries to execute the file in tmp, though (it's not there anymore!)

Changing that argument to destination should work, but I could not get this to re-execute correctly.

@develar
Copy link
Member

develar commented Dec 8, 2017

@siebertm Vielen Dank. Du hast absolut recht.

@develar
Copy link
Member

develar commented Dec 8, 2017

This issue about macOS, not about Linux.

@mobitar Sorry, I haven't yet investigated the issue. It works for me, but yeach, maybe something strange in the Squirrel.Mac. To be investigated later or will be obsolete when DMG update will be implemented.

@arun-nfactorial
Copy link

arun-nfactorial commented Mar 11, 2018

This was working for me before but suddenly seems to have stopped working. The autoupdater downloads the update file and even opens the installer but then everything shuts down almost as if the quit() command quits ALL windows related to my app including the installer. I see a console flash up and then it disappears and the installer quits. Not sure why this happens. Any help would be much appreciated.

*** Just noticed that the console that flashes is taskkill.exe. Any idea why this would be the case? Is it a permissions issue? Am completely at a loss...

I am using the following:

"devDependencies": {
"electron": "^1.8.3",
"electron-builder": "^19.56.2",
"electron-installer-windows": "^0.2.0",
"electron-packager": "^8.5.2",
"electron-winstaller": "^2.5.2",
"grunt-electron-installer": "^2.1.0"
},
"dependencies": {
"auto-launch": "^5.0.1",
"cron": "^1.2.1",
"electron-config": "^0.2.1",
"electron-positioner": "^3.0.0",
"electron-push-receiver": "^1.2.4",
"electron-squirrel-startup": "^1.0.0",
"electron-updater": "^2.19.0",
"electron-window": "^0.8.1",
"graceful-fs": "^4.1.11",
"homedir": "^0.6.0",
"https": "^1.0.0",
"https-proxy-agent": "^1.0.0",
"line-by-line": "^0.1.5",
"mousetrap": "^1.6.1",
"pac-proxy-agent": "^1.0.0",
"url": "^0.11.0",
"winreg": "^1.2.3",
"xml2js": "^0.4.17"
}

@arun-nfactorial
Copy link

I found the reason for this error and it has nothing to do with the autoupdater. I introduced code where I had a .on('close') function for a window. This was causing the issue. Removing this piece of code enabled the updater to work as before.

Hope this helps anyone else having similar issues.

@develar
Copy link
Member

develar commented Apr 18, 2018

What I see in your code:

  win.on('close', (e) => {
    if (willQuitApp) {
      /* the user tried to quit the app */
      win = null;
    } else if(darwin) {
      /* the user only tried to close the window */
      e.preventDefault();
      win.hide();
    }
  })

But problem is that Note: If application quit was initiated by autoUpdater.quitAndInstall() then before-quit is emitted after emitting close event on all windows and closing them.

So, willQuitApp will be false and window is not closed ( e.preventDefault()).

Please try to rework this code. I guess you should listen window-all-closed if you want to restore app windows on user close (https://github.com/develar/onshape-desktop-shell/blob/85563de4e12e706d3d1983a3892ba3d678a97292/src/WindowManager.ts#L16).

@moughxyz
Copy link
Author

moughxyz commented Apr 18, 2018

Does this still apply if I'm not using quitAndInstall? I'm seeing this issue on Mac when I quit the app completely via the dock, by right clicking the icon, then clicking Quit.

The docs say:

Note: If the application is quit without calling this API after the update-downloaded event has been emitted, the application will still be replaced by the updated one on the next run.

quitAndInstall in my understanding is optional? In the case of quitting the app manually, will it still be the same problem?

@develar
Copy link
Member

develar commented Apr 18, 2018

Please try to add some logging to trace events.

@develar develar reopened this Apr 18, 2018
@moughxyz
Copy link
Author

Thanks, doing that now. But still unclear on what I should be looking for. Basically, you're sayinge.preventDefault(); is causing the problem? So, I want to make sure this is not being called when I force quit the app?

@develar
Copy link
Member

develar commented Apr 18, 2018

You can also comment out your close handler to test — if issue still actual :)

@moughxyz
Copy link
Author

Sorry, still a little confused here. On Mac, when the user hits X or Cmd + W, I need the window to hide, but not be destroyed, so that when they re-click the icon in the dock, the same window reappears with the same state. Is this behavior inconsistent with how autoUpdater works?

The only way to do that as far as I know is e.preventDefault() in the close event. I guess it would help to know, when does autoupdater apply the update? Does it hook into any event? If I were to terminate the app completely via Activity Monitor, would autoupdate work on next launch?

@moughxyz
Copy link
Author

moughxyz commented Apr 18, 2018

Ok, looks like it might indeed have something to do with window closing. I'm testing a new install of my app version 2.1.26 with an upgrade pending of 2.1.27. "Quit" means right click icon on Mac and click Quit. If I launch the app and:

  • Quit right away: updates
  • Close window, then quit: updates
  • Close window, reopen window, then quit: doesn't update

Investigating..

@dsabanin
Copy link

dsabanin commented Jun 28, 2018

I noticed in my case that after running quitAndInstall(), the app quits and ShipIt process starts in the background that actually copies the update file. Depending on the size of your app, some of them can be pretty big, and it can take at least 30 seconds to finish. If you try running app right away before that process is over, you get the old version, if you run after ShipIt is done, you'll get the new version. I'm not sure how it's supposed to work 🤷‍♂️

Edit: I'm running this on a Mac.

@radreamer
Copy link

same issue here: #3067

is it enough to have autoUpdater.checkForUpdatesAndNotify() on app init and then:

autoUpdater.on('update-downloaded',() => {
  win.webContents.send('updateReady')
})

?

I asked because according to the documentation autoInstallOnAppQuit = true

@phuonghuynh
Copy link

phuonghuynh commented Nov 13, 2018

Any update on this? I getting exactly this issue with the latest Electron Builder version - 20.35.x

    "electron": "3.0.9",
    "electron-builder": "20.35.0",
    "electron-updater": "4.0.0",

Testing with simple node http-server to serve the request

[Tue Nov 13 2018 18:38:07 GMT+0700 (Indochina Time)] "GET /latest-mac.yml?noCache=1cs6dqhdu" "electron-builder"
[Tue Nov 13 2018 18:38:07 GMT+0700 (Indochina Time)] "GET /xxx-mac-1.0.2.zip" "electron-builder"

The ZIP downloaded, .updaterId and __update__ generated without any issue. Calling "appUpdater.quitAndInstall()" can quit and restart the app but no update. The restart log has one more argument

[2018-11-13 18:57:14.105] [warn] { _: [], p: 'sn_0_7976859' }

@jknoxville
Copy link

I was having this issue and fixed it by running sudo chown root /Applications/<MY-APP> on the installed electron app.
It's not a full solution because I don't know how to ensure this is done for all users in general without running the app as root, but it might point towards what the problem is.

@phuonghuynh
Copy link

Is there any other solution? Since normal users wont have access to sudo as @jknoxville's one.

@klausetgeton
Copy link

Using electron 1.8.8, electron-updater: 3.0.1, electron-builder: 20.22.0.
With this scenario I found out that some task it's still not finished, even after the 'update-downloaded' has been fired. If forcing quit and install right away the error will occur, if some delay occur I can successfully update the application.

After server is closed I can finally update without problems ('Proxy server for native Squirrel.Mac is closed'.)

@netweng
Copy link

netweng commented Nov 23, 2018

i got a same problem before, than i find some of my file can't be executed, so i just run the
chmod -R +x my_file every time after compiling, than it works.
it seems during the install process , our build file need to be executed, need to make sure our build file can be writed, executed.

@dsabanin
Copy link

dsabanin commented Feb 12, 2019

It consistently stopped happening to us anymore after I've implemented 2 things:

  • a wait interval of 20 sec after update is downloaded before notification is given to the user that update is available, to give ShipIt a chance to finish whatever it is doing. I think timeout value has to be proportional to the app size and IO performance of the machine that installs the update. Our app is 240MB.
  • added this code before the electron startup procedure https://gist.github.com/dsabanin/aadfbe508a627a3e95e3f024d2e5207d

I'm not sure if that is a universal solution, but it worked great for us.

@cenkingunlugu
Copy link

Friends, I found the problem.

In my electron-builder configuration, I did not have "appId" when I was facing the same problem.
Let's say my app name is: XApp. It was creating a "com.electron.XApp.shipIt" folder on mac (inside "~/Library/Caches" for the updater. It was downloading, it was closing the app, but it was not re-opening. After some research, I notice that I need to check logs of the folder I wrote above.

Then I checked it, and I notice that it is com.electron.blabla. After adding "appId" to my build configuration, rebuilding and creating the next release, I noticed that it started working.

I hope this information will be useful for people who are facing the same problem.

@nicmosc
Copy link

nicmosc commented Feb 18, 2019

Hello everyone.

After spending many hours trying to debug the issue I went through the autoUpdate error logs (at ~/Library/Caches/com.electron.[appName].ShipIt/ShipIt_stderr.log and saw the issue was coming from a permission denied error when the updater was trying to write back to the target location where the app is found (should be under targetBundleURL in the ShipItState.plist).

The error was 13 Permission Denied, and after following this thread electron/electron#9752, trying to set the whole app bundle to write permissions, that still failed. Turns out there was a file in the node_modules cache from the uglifyjs plugin (I use webpack to bundle the app) that could not be overridden, and that stopped the autoUpdater from writing back to the target location, hence the app stayed at the previous version.

It was just a matter of disabling the plugin cache option to stop that file from being created, and now the update works flawlessly, no strange hacks required.

In conclusion if you're also stuck trying to get the autoupdate to work I suggest you first check that log file to see if it is due to a permission error, in which case it's easy to debug because you should have the exact location of the problematic file in the logs. Get rid of those files and it should work!

@wormangel
Copy link

I'm facing precisely the same behavior but on Windows (if user opens the application too quickly - which is quite common as the silent install takes some seconds to finish and doesn't show any feedback - it just gets in this loop of saying it has a new version 'ready to install upon quit')..

@avner-hoffmann
Copy link

I used @dsabanin solution and it worked perfectly.
the wait interval wasn't needed though, only the code added as @dsabanin suggested

@Arama2014
Copy link

2019-06-05 02:25:11.142 ShipIt[86158:15251279] Beginning installation
2019-06-05 02:25:23.310 ShipIt[86158:15251279] Moved bundle from file:///Applications/Unomi.app/ to file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.KREdjnRO/Unomi.app
2019-06-05 02:25:23.310 ShipIt[86158:15251279] Moved bundle from file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.ziwDs0ab/Unomi.app to file:///Applications/Unomi.app/
2019-06-05 02:25:23.494 ShipIt[86158:15251279] Couldn't remove owned bundle at location file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.ziwDs0ab/Unomi.app, error NSError { domain: NSCocoaErrorDomain, code: 4, description: "“Unomi.app” couldn’t be removed.", failureReason: "The file doesn’t exist.", underlying error: NSError { domain: NSPOSIXErrorDomain, code: 2, description: "The operation couldn’t be completed. No such file or directory" }, userInfo: {
    NSFilePath = "/var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.ziwDs0ab/Unomi.app";
    NSUserStringVariant =     (
        Remove
    );
} }
2019-06-05 02:25:24.429 ShipIt[86158:15251279] Installation completed successfully
2019-06-05 02:25:24.534 ShipIt[86158:15251565] Application launched at file:///Applications/Unomi.app/
2019-06-05 02:25:24.535 ShipIt[86158:15251565] ShipIt quitting
2019-06-05 02:30:10.312 ShipIt[86189:15255077] Beginning installation
2019-06-05 02:30:22.732 ShipIt[86189:15255256] Moved bundle from file:///Applications/Unomi.app/ to file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.1MOa6ADp/Unomi.app
2019-06-05 02:30:22.732 ShipIt[86189:15255256] Moved bundle from file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.1MBp2iOA/Unomi.app to file:///Applications/Unomi.app/
2019-06-05 02:30:22.871 ShipIt[86189:15255256] Couldn't remove owned bundle at location file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.1MBp2iOA/Unomi.app, error NSError { domain: NSCocoaErrorDomain, code: 4, description: "“Unomi.app” couldn’t be removed.", failureReason: "The file doesn’t exist.", underlying error: NSError { domain: NSPOSIXErrorDomain, code: 2, description: "The operation couldn’t be completed. No such file or directory" }, userInfo: {
    NSFilePath = "/var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.1MBp2iOA/Unomi.app";
    NSUserStringVariant =     (
        Remove
    );
} }
2019-06-05 02:30:22.984 ShipIt[86189:15255256] Installation completed successfully
2019-06-05 02:30:22.998 ShipIt[86189:15255077] Application launched at file:///Applications/Unomi.app/
2019-06-05 02:30:22.998 ShipIt[86189:15255077] ShipIt quitting
2019-06-05 02:46:23.903 ShipIt[86363:15266795] Beginning installation
2019-06-05 02:46:34.181 ShipIt[86363:15267122] Moved bundle from file:///Applications/Unomi.app/ to file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.MRrvc3Gn/Unomi.app
2019-06-05 02:46:34.181 ShipIt[86363:15267122] Moved bundle from file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.rjR6GklM/Unomi.app to file:///Applications/Unomi.app/
2019-06-05 02:46:34.353 ShipIt[86363:15267122] Couldn't remove owned bundle at location file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.rjR6GklM/Unomi.app, error NSError { domain: NSCocoaErrorDomain, code: 4, description: "“Unomi.app” couldn’t be removed.", failureReason: "The file doesn’t exist.", underlying error: NSError { domain: NSPOSIXErrorDomain, code: 2, description: "The operation couldn’t be completed. No such file or directory" }, userInfo: {
    NSFilePath = "/var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.rjR6GklM/Unomi.app";
    NSUserStringVariant =     (
        Remove
    );
} }
2019-06-05 02:46:34.750 ShipIt[86363:15267122] Installation completed successfully
2019-06-05 02:46:34.750 ShipIt[86363:15267122] ShipIt quitting
2019-06-05 02:51:56.893 ShipIt[86383:15270351] Beginning installation
2019-06-05 02:52:10.594 ShipIt[86383:15270351] Moved bundle from file:///Applications/Unomi.app/ to file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.gHt7407R/Unomi.app
2019-06-05 02:52:10.595 ShipIt[86383:15270351] Moved bundle from file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.VltnIpHw/Unomi.app to file:///Applications/Unomi.app/
2019-06-05 02:52:10.862 ShipIt[86383:15270351] Couldn't remove owned bundle at location file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.VltnIpHw/Unomi.app, error NSError { domain: NSCocoaErrorDomain, code: 4, description: "“Unomi.app” couldn’t be removed.", failureReason: "The file doesn’t exist.", underlying error: NSError { domain: NSPOSIXErrorDomain, code: 2, description: "The operation couldn’t be completed. No such file or directory" }, userInfo: {
    NSFilePath = "/var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.VltnIpHw/Unomi.app";
    NSUserStringVariant =     (
        Remove
    );
} }
2019-06-05 02:52:11.061 ShipIt[86383:15270351] Installation completed successfully
2019-06-05 02:52:11.075 ShipIt[86383:15270568] Application launched at file:///Applications/Unomi.app/
2019-06-05 02:52:11.076 ShipIt[86383:15270568] ShipIt quitting
2019-06-05 03:01:31.651 ShipIt[86423:15275891] Beginning installation
2019-06-05 03:01:41.880 ShipIt[86423:15278301] Moved bundle from file:///Applications/Unomi.app/ to file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.EHegXM6I/Unomi.app
2019-06-05 03:01:41.882 ShipIt[86423:15278301] Moved bundle from file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.xtWSeCkl/Unomi.app to file:///Applications/Unomi.app/
2019-06-05 03:01:41.961 ShipIt[86423:15278301] Couldn't remove owned bundle at location file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.xtWSeCkl/Unomi.app, error NSError { domain: NSCocoaErrorDomain, code: 4, description: "“Unomi.app” couldn’t be removed.", failureReason: "The file doesn’t exist.", underlying error: NSError { domain: NSPOSIXErrorDomain, code: 2, description: "The operation couldn’t be completed. No such file or directory" }, userInfo: {
    NSFilePath = "/var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.xtWSeCkl/Unomi.app";
    NSUserStringVariant =     (
        Remove
    );
} }
2019-06-05 03:01:42.019 ShipIt[86423:15278301] Installation completed successfully
2019-06-05 03:01:42.020 ShipIt[86423:15278301] ShipIt quitting
2019-06-05 03:26:06.782 ShipIt[87080:15301198] Beginning installation
2019-06-05 03:26:29.956 ShipIt[87080:15301515] Moved bundle from file:///Applications/Unomi.app/ to file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.IHOptsT8/Unomi.app
2019-06-05 03:26:29.957 ShipIt[87080:15301515] Moved bundle from file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.A7bOfF88/Unomi.app to file:///Applications/Unomi.app/
2019-06-05 03:26:30.102 ShipIt[87080:15301515] Couldn't remove owned bundle at location file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.A7bOfF88/Unomi.app, error NSError { domain: NSCocoaErrorDomain, code: 4, description: "“Unomi.app” couldn’t be removed.", failureReason: "The file doesn’t exist.", underlying error: NSError { domain: NSPOSIXErrorDomain, code: 2, description: "The operation couldn’t be completed. No such file or directory" }, userInfo: {
    NSFilePath = "/var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.A7bOfF88/Unomi.app";
    NSUserStringVariant =     (
        Remove
    );
} }
2019-06-05 03:26:30.202 ShipIt[87080:15301515] Installation completed successfully
2019-06-05 03:26:30.325 ShipIt[87080:15301198] Application launched at file:///Applications/Unomi.app/
2019-06-05 03:26:30.325 ShipIt[87080:15301198] ShipIt quitting
2019-06-05 03:31:29.324 ShipIt[87174:15309426] Beginning installation
2019-06-05 03:31:46.170 ShipIt[87174:15309891] Moved bundle from file:///Applications/Unomi.app/ to file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.QAfHofQD/Unomi.app
2019-06-05 03:31:46.172 ShipIt[87174:15309891] Moved bundle from file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.3gZOIZ5J/Unomi.app to file:///Applications/Unomi.app/
2019-06-05 03:31:46.347 ShipIt[87174:15309891] Couldn't remove owned bundle at location file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.3gZOIZ5J/Unomi.app, error NSError { domain: NSCocoaErrorDomain, code: 4, description: "“Unomi.app” couldn’t be removed.", failureReason: "The file doesn’t exist.", underlying error: NSError { domain: NSPOSIXErrorDomain, code: 2, description: "The operation couldn’t be completed. No such file or directory" }, userInfo: {
    NSFilePath = "/var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.3gZOIZ5J/Unomi.app";
    NSUserStringVariant =     (
        Remove
    );
} }
2019-06-05 03:31:46.474 ShipIt[87174:15309891] Installation completed successfully
2019-06-05 03:31:46.532 ShipIt[87174:15309898] Application launched at file:///Applications/Unomi.app/
2019-06-05 03:31:46.533 ShipIt[87174:15309898] ShipIt quitting
2019-06-05 04:02:14.096 ShipIt[87331:15331522] Beginning installation
2019-06-05 04:02:29.563 ShipIt[87331:15335025] Moved bundle from file:///Applications/Unomi.app/ to file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.un4XcwIz/Unomi.app
2019-06-05 04:02:29.563 ShipIt[87331:15335025] Moved bundle from file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.qC91qiKs/Unomi.app to file:///Applications/Unomi.app/
2019-06-05 04:02:29.658 ShipIt[87331:15335025] Couldn't remove owned bundle at location file:///var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.qC91qiKs/Unomi.app, error NSError { domain: NSCocoaErrorDomain, code: 4, description: "“Unomi.app” couldn’t be removed.", failureReason: "The file doesn’t exist.", underlying error: NSError { domain: NSPOSIXErrorDomain, code: 2, description: "The operation couldn’t be completed. No such file or directory" }, userInfo: {
    NSFilePath = "/var/folders/ph/gbqpvh454d18mjswphbgb53r0000gn/T/com.electron.unomi.ShipIt.qC91qiKs/Unomi.app";
    NSUserStringVariant =     (
        Remove
    );
} }
2019-06-05 04:02:30.035 ShipIt[87331:15335025] Installation completed successfully
2019-06-05 04:02:30.153 ShipIt[87331:15335480] Application launched at file:///Applications/Unomi.app/
2019-06-05 04:02:30.153 ShipIt[87331:15335480] ShipIt quitting

Well at first I thought It wasn't working, but it turns out I'm manually opening the application after it closes but before it automatically re-starts after calling quitAndInstall(). I guess the auto-restart is being delayed by these shipit errors? Any thoughts @nicmosc? Also thanks for saving me an hour or two with the location of those error logs 👍

@avner-hoffmann
Copy link

Hi @Arama2014,
Where do you get those ShipIt logs from? Can you share it with us? It will be very helpful to know why the update process has failed

@Arama2014
Copy link

Arama2014 commented Jun 5, 2019

Hello @avner-hoffmann.

~/Library/Caches/com.electron.[appName].ShipIt/ShipIt_stderr.log

Credit for location of those logs goes to @nicmosc from a few posts up:

Hello everyone.

After spending many hours trying to debug the issue I went through the autoUpdate error logs (at ~/Library/Caches/com.electron.[appName].ShipIt/ShipIt_stderr.log and saw the issue was coming from a permission denied error when the updater was trying to write back to the target location where the app is found (should be under targetBundleURL in the ShipItState.plist).

The error was 13 Permission Denied, and after following this thread electron/electron#9752, trying to set the whole app bundle to write permissions, that still failed. Turns out there was a file in the node_modules cache from the uglifyjs plugin (I use webpack to bundle the app) that could not be overridden, and that stopped the autoUpdater from writing back to the target location, hence the app stayed at the previous version.

It was just a matter of disabling the plugin cache option to stop that file from being created, and now the update works flawlessly, no strange hacks required.

In conclusion if you're also stuck trying to get the autoupdate to work I suggest you first check that log file to see if it is due to a permission error, in which case it's easy to debug because you should have the exact location of the problematic file in the logs. Get rid of those files and it should work!

Specifically: ~/Library/Caches/com.electron.[appName].ShipIt/ShipIt_stderr.log
MacOS (not sure where the cache location would be on other operating systems.)

@nicmosc
Copy link

nicmosc commented Jun 5, 2019

@Arama2014 I’m not sure actually, like I said in my answer I was getting a Permission denied, so not sure what your issue could be. I’ll see if I have those old logs and take a look as well

@stale
Copy link

stale bot commented Aug 4, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the backlog label Aug 4, 2019
@semireg
Copy link

semireg commented Aug 6, 2019

If I download my Mac app as a zip, the time it takes to decompress into .app is roughly equivalent to the amount of time I must wait (via setTimeout) before I allow the user to try to install an update. This IO issue could certainly be handled at a lower level...

@stale stale bot removed the backlog label Aug 6, 2019
@mangolds
Copy link

mangolds commented Aug 28, 2019

Hi All - In my case (on a Mac), this issue was caused by the 'update' certificate not matching the previous certificate used to sign my app. For me, the behavior was not intermittent, it would occur during every update attempt:

  1. App detects update is available and shows 'download' modal
  2. On click download button, download status indicator shows beneath the app icon - dowload occurs successfully
  3. Downloaded DMG never installs

In my application log, I would see the following message:

Error: Code signature at URL file:///Users/blah/Library/Caches/blah did not pass validation: code failed to satisfy specified code requirement(s)
Proxy server for native Squirrel.Mac is closed (was started to download https://github.blah.com)

I believe this error is thrown if:

  • Your certificate is expired
  • The certificate used to sign the update is different than the existing certificate

In my case, the certificate used to sign the app was owned by another team member and it had expired. I ended up creating a DMG signed with a new certificate, and had my users update manually. Once the new certificate was in place, subsequent app updates worked normally as before.

This obviously isn't ideal if you have a huge install base. I don't know if there is a setting to loosen app signing restrictions i.e. where are the 'code signing requirements' specified in the error log?

Check your logs and certificates! Hope this helps somebody.

@stevenroussey-privicy
Copy link

How does anyone get these ShipIt_stderr.log log files? They are nowhere to be found for me.

@transparentech
Copy link

@stevenroussey-privicy Don't know if you found them or not, but just to clarify for future readers, the ShipIt logs seem to be under ~/Library/Caches/<appId>.ShipIt

@kaitlynbrown
Copy link

Seeing the same problem on windows with nsis installer.

@cyphercodes96
Copy link

Windows NSIS same issue

Dev Dependencies:

"electron": "^4.2.9",
"electron-builder": "^21.2.0",
"electron-download": "^4.1.1",
"electron-publisher-s3": "^20.15.0",
"electron-reload": "1.4.0",

Any resolutions?

@transparentech
Copy link

I have the problem on window NSIS too. I'm using electron-builder 21.2.0.

The issue seems to be in this commit: 39e6783

I'm not a windows person, so I'm not exactly sure why that commit breaks the auto-update, but I suspect/speculate that it has something to do either with the change to the uninstaller name (removing the '.') or the change to the taskkill invocation (adding the '/t' arg).

In any case, I created a fork of electron-builder (from tag 'v21.2.0') and reverted that particular commit, then built my project with the forked version and auto-update worked again.

@transparentech
Copy link

@kaitlynbrown @cyphercodes96 Might be better to open new issue as this one is old and was about Mac, not Windows.

@damianobarbati
Copy link

@transparentech I am dealing with this since 10 days ago on NSIS, after I had to upgrade electron-builder because of the hardenedRuntime needed to Catalina.

How can I apply your solution? I didn't understand.

@YoucefBadaoui
Copy link

anyone found a solution yet?

@kaitlynbrown
Copy link

@iJosephY for me the problem was that I had closable set to false on my window, which prevented the update from being installed. It seems like there may be other things than can cause auto update to fail in this way, however

@YoucefBadaoui
Copy link

Thanks for your comment @kaitlynbrown
i opened a new issue here:
#4526

and there was some other solutions there .. the issue appear to be with electron 7 and electron-builder 22
downgrading to electron 6 seems to fix it for me.

@transparentech
Copy link

@damianobarbati My fork is here (branch=sme): https://github.com/transparentech/electron-builder

It works with Electron 7, hand has the commit mentioned about reverted.

@stale
Copy link

stale bot commented Feb 15, 2020

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the backlog label Feb 15, 2020
@stale stale bot closed this as completed Feb 22, 2020
@avner-hoffmann
Copy link

avner-hoffmann commented May 20, 2020

@develar - Did anyone from the electron-builder maintainers had a look on all of the above?
it seems this issue is actually 3 or 4 issues. was something fixed here in the newer versions of electron ?
specifically I'm interested of the issue when a new update is downloaded but the app is opened before ShipIt finish copying the new file to the destination location, hence the old version runs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests