0

So I'm using the inline script on Azure DevOps, what variables or string should I add to continue to the next script once the npm run start completed, because at the moment my pipeline hangs at after starting the script and not gong to the next frontend script :

$backendFolder = "C:\path\to\backend"
$nodejsExecutable = "C:\Program Files\nodejs\npm.cmd"

Set-location $backendFolder
Start-Process -FilePath $nodejsExecutable -ArgumentList "run","build" -wait -NoNewWindow -ErrorAction Stop -Verbose -WorkingDirectory $backendFolder
Start-Process -FilePath $nodejsExecutable -ArgumentList "run","start" -wait -NoNewWindow -ErrorAction Stop -Verbose -WorkingDirectory $backendFolder

enter image description here

What am I missing here?

Notes # I've tried a lot of different combinations of the Start-Process command but still no go, I've also followed a couple of blog post, not going to share each and everyone here, as it's a lot but here is 2 > https://lazyadmin.nl/powershell/start-process/ & https://ss64.com/ps/

jtvdw
  • 79
  • 2
  • 7
  • As an aside: there's no reason to use `Start-Process` to synchronously run console applications, just invoke them directly, .e.g.: `& $nodejsExecutable run build` - see [this answer](https://stackoverflow.com/a/68628269/45375). – mklement0 Jan 18 '23 at 20:19
  • I've tested that command now but still not solves the problem of going to the next task `& $nodejsExecutable run start` but playing around to see if I can get it working. – jtvdw Jan 18 '23 at 20:32
  • I didn't expect direct execution to make a difference in the case at hand, which is why I called it an aside, but it's hopefully a generally useful simplification. As for the problem at hand: If execution gets stuck, perhaps there's some (unexpected) interactive prompt that is put up? – mklement0 Jan 18 '23 at 20:35
  • Thanks for that. I had a look and nothing else strange in the logs, it's just running as if you run `npm run start` in powershell. – jtvdw Jan 18 '23 at 20:42

0 Answers0