coreybutler / node-windows

Windows support for Node.JS scripts (daemons, eventlog, UAC, etc).
Other
2.81k stars 356 forks source link

Issue with running node-windows script from Innosetup #265

Closed bitshiftnetau closed 4 years ago

bitshiftnetau commented 4 years ago

Having issues running node-windows script from innosetup. Have tried using both Filename execute and pascalScript methods.

See stack thread here: Issue with installing node application as a service using innosetup and node-windows as a script

coreybutler commented 4 years ago

This is kind of tough to troubleshoot, but I suspect the InnoSetup process may be creating an orphan directory.

From what I can tell in the line below, the current working directory is relative to the InnoSetup process:

Filename: "{pf64}\nodejs\node.exe"; Parameters: "{app}\validation-installer-node-windows.js";

If memory serves, this defaults to a temporary directory. This would explain why it works partially with InnoSetup and completely without it.

I'd recommend explicitly defining the current working directory to assure this line is writing the output to the appropriate directory. I can't remember exactly how that's done with InnoSetup off the top of my head, but I remember dealing with something similar in the NVM for Windows install script.

bitshiftnetau commented 4 years ago

Ok cool. That makes sense.

Do you mean the {app} variable?

bitshiftnetau commented 4 years ago

Ok so you were of course correct. I did not set the WorkingDir parameter, nor was I passing in the correct parameters to ShellExec.

coreybutler commented 4 years ago

Glad you got it figured out @bitshiftnetau, happy coding!