From ca33bc449fdfe940206fe0a0d49e607c76c96a3b Mon Sep 17 00:00:00 2001 From: nikolaia Date: Fri, 4 Aug 2017 14:14:35 +0200 Subject: [PATCH 1/2] Change how npm.cmd is located in NpmHelper I've noticed that Yarn adds `nodejs\bin` to the path variable, which would return in the old method used to find npm.cmd, but not actually contain the npm.cmd file. I also removed the fallback to the npm.js package, as it is silly to assume where the package directory is. If people are using that package they should overwrite the NpmFilePath variable. --- src/app/FakeLib/NpmHelper.fs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/FakeLib/NpmHelper.fs b/src/app/FakeLib/NpmHelper.fs index 5af0b002a5f..93d71e9c226 100644 --- a/src/app/FakeLib/NpmHelper.fs +++ b/src/app/FakeLib/NpmHelper.fs @@ -11,11 +11,11 @@ let private npmFileName = | 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" + |> Seq.filter (fun p -> p.Contains "nodejs") + |> Seq.tryFind (sprintf @"%s\npm.cmd" >> File.Exists) + |> function + | Some npm -> (sprintf @"%s\npm.cmd" npm) + | None -> "Unable to find npm.cmd. Make sure you have the folder that holds npm.cmd in your PATH environment variable. Optionally you can set the NpmFilePath input parameter." | _ -> let info = new ProcessStartInfo("which","npm") info.StandardOutputEncoding <- System.Text.Encoding.UTF8 From 4a4bcb8327936a092ed7fd5e1da17b1504a99b2e Mon Sep 17 00:00:00 2001 From: nikolaia Date: Fri, 18 Aug 2017 10:52:02 +0200 Subject: [PATCH 2/2] Add missing failwith --- src/app/FakeLib/NpmHelper.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/FakeLib/NpmHelper.fs b/src/app/FakeLib/NpmHelper.fs index 93d71e9c226..be306d16fc4 100644 --- a/src/app/FakeLib/NpmHelper.fs +++ b/src/app/FakeLib/NpmHelper.fs @@ -15,7 +15,7 @@ let private npmFileName = |> Seq.tryFind (sprintf @"%s\npm.cmd" >> File.Exists) |> function | Some npm -> (sprintf @"%s\npm.cmd" npm) - | None -> "Unable to find npm.cmd. Make sure you have the folder that holds npm.cmd in your PATH environment variable. Optionally you can set the NpmFilePath input parameter." + | None -> failwith "Unable to find npm.cmd. Make sure you have the folder that holds npm.cmd in your PATH environment variable. Optionally you can set the NpmFilePath input parameter." | _ -> let info = new ProcessStartInfo("which","npm") info.StandardOutputEncoding <- System.Text.Encoding.UTF8