diff --git a/Nodejs/Product/Nodejs/Nodejs.cs b/Nodejs/Product/Nodejs/Nodejs.cs index 140719cca..cce4dac8e 100644 --- a/Nodejs/Product/Nodejs/Nodejs.cs +++ b/Nodejs/Product/Nodejs/Nodejs.cs @@ -92,10 +92,12 @@ public static string GetPathToNodeExecutableFromEnvironment(string executable = // If we didn't find node.js in the registry we should look at the user's path. foreach (var dir in Environment.GetEnvironmentVariable("PATH").Split(Path.PathSeparator)) { - var execPath = Path.Combine(dir, executable); - if (File.Exists(execPath)) { - return execPath; - } + try { + var execPath = Path.Combine(dir, executable); + if (File.Exists(execPath)) { + return execPath; + } + } catch (ArgumentException) { /*noop*/ } } // It wasn't in the users path. Check Program Files for the nodejs folder.