@@ -222,7 +222,7 @@ protected virtual ProcessStartInfo PrepareNodeProcessStartInfo(
222222 }
223223 else
224224 {
225- debuggingArgs = string . Empty ;
225+ debuggingArgs = string . Empty ;
226226 }
227227
228228 var thisProcessPid = Process . GetCurrentProcess ( ) . Id ;
@@ -325,17 +325,26 @@ private static void SetEnvironmentVariable(ProcessStartInfo startInfo, string na
325325
326326 private static Process LaunchNodeProcess ( ProcessStartInfo startInfo )
327327 {
328- var process = Process . Start ( startInfo ) ;
329-
330- // On Mac at least, a killed child process is left open as a zombie until the parent
331- // captures its exit code. We don't need the exit code for this process, and don't want
332- // to use process.WaitForExit() explicitly (we'd have to block the thread until it really
333- // has exited), but we don't want to leave zombies lying around either. It's sufficient
334- // to use process.EnableRaisingEvents so that .NET will grab the exit code and let the
335- // zombie be cleaned away without having to block our thread.
336- process . EnableRaisingEvents = true ;
337-
338- return process ;
328+ try {
329+ var process = Process . Start ( startInfo ) ;
330+
331+ // On Mac at least, a killed child process is left open as a zombie until the parent
332+ // captures its exit code. We don't need the exit code for this process, and don't want
333+ // to use process.WaitForExit() explicitly (we'd have to block the thread until it really
334+ // has exited), but we don't want to leave zombies lying around either. It's sufficient
335+ // to use process.EnableRaisingEvents so that .NET will grab the exit code and let the
336+ // zombie be cleaned away without having to block our thread.
337+ process . EnableRaisingEvents = true ;
338+
339+ return process ;
340+ } catch ( Exception ex ) {
341+ var message = "Failed to start Node process. To resolve this:.\n \n "
342+ + "[1] Ensure that Node.js is installed and can be found in one of the PATH directories.\n "
343+ + $ " Current PATH enviroment variable is: { Environment . GetEnvironmentVariable ( "PATH" ) } \n "
344+ + " Make sure the Node executable is in one of those directories, or update your PATH.\n \n "
345+ + "[2] See the InnerException for further details of the cause." ;
346+ throw new InvalidOperationException ( message , ex ) ;
347+ }
339348 }
340349
341350 private static string UnencodeNewlines ( string str )
0 commit comments