Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for npm on path variable in NpmHelper on Windows #1371

Merged
merged 1 commit into from
Sep 5, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/app/FakeLib/NpmHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ open System.Diagnostics

/// Default paths to Npm
let private npmFileName =
match isUnix with
match isWindows with
| true ->
System.Environment.GetEnvironmentVariable("PATH")
|> fun path -> path.Split ';'
|> Seq.tryFind (fun p -> p.Contains "nodejs")
|> fun res ->
match res with
| Some npm when File.Exists (sprintf @"%s\npm.cmd" npm) -> (sprintf @"%s\npm.cmd" npm)
| _ -> "./packages/Npm.js/tools/npm.cmd"
| _ ->
let info = new ProcessStartInfo("which","npm")
info.StandardOutputEncoding <- System.Text.Encoding.UTF8
info.RedirectStandardOutput <- true
Expand All @@ -20,7 +28,8 @@ let private npmFileName =
| 0 when not proc.StandardOutput.EndOfStream ->
proc.StandardOutput.ReadLine()
| _ -> "/usr/bin/npm"
| _ -> "./packages/Npm.js/tools/npm.cmd"



/// Arguments for the Npm install command
type InstallArgs =
Expand Down