The problem was that I was using Exec
but because of the nature of npm
, it needed to use a shell command. So instead, as TLama mentioned in the comments, I used ShellExec
and everything worked.
function InstallNodeApp: Integer;
var
C, P, D: String;
begin
C:= 'npm';
P:= 'install --silent';
D:= ExpandConstant('{app}');
if not ShellExec('', C, P, D, SW_HIDE, ewWaitUntilTerminated, Result) then begin
Result:= -1;
end;
end;