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

Windows 8.1 not completing update process #70

Open
hermwong opened this issue Feb 3, 2015 · 15 comments
Open

Windows 8.1 not completing update process #70

hermwong opened this issue Feb 3, 2015 · 15 comments
Labels

Comments

@hermwong
Copy link

hermwong commented Feb 3, 2015

Here are the steps that occur when I use the node-webkit-updater on Windows 8.1:

  1. app detects a new version available
  2. new version is downloaded & unzipped to temp directory
  3. app closes
  4. the new app in temp directory doesn't run
  5. the new app doesn't get copied from the temp directory to the app's exec/install directory

Basically the app will download the updated version and then quit, but won't relaunch the downloaded new version.

@adam-lynch
Copy link
Collaborator

Did you try using gui.Shell.openItem?

@hermwong
Copy link
Author

hermwong commented Feb 6, 2015

I'm basically using the example code, on OSX it is able to detect, download, update and relaunch my app, however on Windows it only seems to detect and download my app but never performs the update and relaunch.

@adam-lynch
Copy link
Collaborator

Instead of upd.run(execPath, null);, try gui.Shell.openItem(execPath).

@hermwong
Copy link
Author

hermwong commented Feb 6, 2015

Thanks @adam-lynch, I'll give it a try and let you know how it goes.

@hermwong
Copy link
Author

hermwong commented Feb 9, 2015

I'm getting the same result with gui.Shell.openItem(execPath); it works on OSX but fails on Windows 8.1.

@adam-lynch
Copy link
Collaborator

Is execPath what you'd expect? (The path to the .exe of the new update)

@MichaelIT
Copy link

I have problem on Windows 8.1 too,
I check my code,and found :
1、app detects a new version available
2、new version is downloaded & unzipped to temp directory
3、app closes
4、the new app in temp directory run
5、the new app doesn't get copied from the temp directory to the app's exec/install directory, And I check the old version folder ,it was occupied by the new app run from temp directory.

@MichaelIT
Copy link

I resolved my problem by create a bat file and gui.Shell.openItem() to run my update app as a new instance of nw.
var pathName = path.dirname(newAppPath)
var installName = pathName + "/install.bat"
fs.writeFileSync(installName,newAppPath+" "+ upd.getAppPath() + " "+upd.getAppExec(), "UTF-8",{'flags': 'w+'});
gui.Shell.openItem(installName)
gui.App.quit();

@adam-lynch
Copy link
Collaborator

@Michael00767

And I check the old version folder ,it was occupied by the new app run from temp directory.

This sounds like it is being copied?

I'm not sure you need to do what you're doing.

@hermwong
Copy link
Author

@adam-lynch

Here is what I'm seeing when retrieving the various paths (on Windows 8.1):

newAppPath = C:\Users\hermwong\AppData\Local\Temp\PhoneGap-Desktop-Beta-0.1.4-win\PhoneGap.exe
upd.getAppExec() = C:\Program Files (x86)\Adobe\PhoneGap\PhoneGap Desktop\
upd.getAppPath() = C:\Program Files (x86)\Adobe\PhoneGap\PhoneGap Desktop\

When I execute: upd.runInstaller(newAppPath, [copyPath, execPath],{});, my App crashes

@hermwong
Copy link
Author

I've attached the screenshot of the error message from the App crash.

screen shot 2015-04-21 at 3 27 11 pm

Uncaught node.js Error

Error: spawn ENOENT
    at exports._errnoException (util.js:742:11)
    at Process.ChildProcess._handle.onexit (child_process.js:1027:32)
    at child_process.js:1110:20
    at process._tickCallback (node.js:382:11)

@aacotroneo
Copy link

Hey guys!! This is an awesome app! I have local copy totally slaughtered so I can't test this quickly.. But I think I know the problem...
when you call -> upd.run(execPath, null); spawn gets a spawn("string", null, {xxx}); I think is not liking it! Try upd.run(execPath, []); or change updater.js so it gets a [] as a second parameter instead of null

@amsoell
Copy link

amsoell commented Jun 21, 2016

Has anyone found a confirmed way to work around this bug? I'm experiencing the same trouble on Windows 10—the .zip file downloads and extracts, but the new process never starts up when the old version quits.

@adam-lynch
Copy link
Collaborator

Hmm @hermwong this is weird. The result of getAppPath and getAppPath should never be the same on Windows. See here https://github.com/edjafarov/node-webkit-updater/blob/master/app/updater.js#L138 that getAppExec is the result of joining getAppPath (the parent directory of the app) and the app's basename (therefore it's just process.execPath really).

@aacotroneo
Copy link

aacotroneo commented Jul 3, 2016

did you try what I mentioned @amsoell ? child_process.spawn signature is (String[, Array][, Object]), and the updater ends up invoking with (<String>, null, <Object>). It's a 5 minutes check man https://github.com/edjafarov/node-webkit-updater/blob/master/examples/basic.js#L29

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

No branches or pull requests

5 participants