I have written script to install Node.js, run shell script and Windows service using Inno Setup. I have created a setup. When I install my setup Node.js gets successfully installed.
[Run]
Filename: "msiexec.exe"; Parameters: "/i ""{app}\nodejs\node-v8.11.1-x64.msi""";
Shell scripts runs successfully.
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
var
ErrorCode: Integer;
ReturnCode: Boolean;
begin
ExtractTemporaryFile('Add-AppDevPackage.ps1');
ReturnCode :=
ShellExec('open', '"PowerShell"',
ExpandConstant(' -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File "{app}\setup\Add-AppDevPackage.ps1"'),
'', SW_SHOWNORMAL, ewWaitUntilTerminated, ErrorCode);
if (ReturnCode = False) then
MsgBox('Message about problem. Error code: ' + IntToStr(ErrorCode) + ' ' + SysErrorMessage(ErrorCode),
mbInformation, MB_OK);
end;
But when I try to run Windows service which is a .js file (installservice.js
), I get an error like
Unable to run node. Create Process failed code2.
Code used to run the node:
[Run]
Filename: "node"; Parameters: "installservice.js"; WorkingDir: "{app}\nodepath"; \
Flags: nowait postinstall skipifsilent runascurrentuser; AfterInstall: MsbShow;
And I also found that if the Node JS is already installed in the machine then the Windows service installs and runs perfectly. I don't know where the error is. I even tried to run the Windows service post install but still the problem persist. Can you guide me in this process?