Closed davistran86 closed 5 years ago
If I run 'powershell -NoLogo' in powershell then run the script again then it works. Something wrong with the shell when it is spawned ?
I think the error when the shell is spawned is:
'-' was specified as the argument to -Command but standard input has not been redirected for this process.
With manually running powershell -Nologo
, I can start the script with node or nodemon OK but if I use pm2 it's still error as pm2 spawn new window
I fixed it.
In Shell.js change
const proc = spawn(`${psProc}${!isWin ? "" : ".exe"}`, psOpts, {
stdio: "pipe"
});
To
const proc = spawn(`${psProc}${!isWin ? "" : ".exe"}`, psOpts, {
stdio: "pipe",
shell: isWin,
windowsHide: isWin
});
Everything is running fine on Windows 10 but when I moved it to Windows Server 2012 R2 for production then it crashed every time I run it.
I tried with the example from this repo as well, but it still crash. It seems cannot spawn the shell.
I'm running node 10.16.x on Windows Server 2012 R2