Commit 7376234 1 parent 404f70e commit 7376234 Copy full SHA for 7376234
File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -3,12 +3,22 @@ module Fake.NpmHelper
3
3
open Fake
4
4
open System
5
5
open System.IO
6
+ open System.Diagnostics
6
7
7
8
/// Default paths to Npm
8
9
let private npmFileName =
9
10
match isUnix with
10
- | true when File.Exists( " /usr/bin/npm" ) -> " /usr/bin/npm"
11
- | true when File.Exists( " /usr/local/bin/npm" ) -> " /usr/local/bin/npm"
11
+ | true ->
12
+ let info = new ProcessStartInfo( " which" , " npm" )
13
+ info.RedirectStandardOutput <- true
14
+ info.UseShellExecute <- false
15
+ info.CreateNoWindow <- true
16
+ use proc = Process.Start info
17
+ proc.WaitForExit()
18
+ match proc.ExitCode with
19
+ | 0 when not proc.StandardOutput.EndOfStream ->
20
+ proc.StandardOutput.ReadLine()
21
+ | _ -> " /usr/bin/npm"
12
22
| _ -> " ./packages/Npm.js/tools/npm.cmd"
13
23
14
24
/// Arguments for the Npm install command
You can’t perform that action at this time.
0 commit comments