F# Fake run in WSL2 resolves the program path in the hosting Windows, not in Linux

Viewed 80

Environment

  • WSL2 Ubuntu 20.04 from Windows 10 Home
  • Linux .Net Core 3.1
  • Node 12.18.3 + NPM 6.14.6 + Yarn 1.22.5

Problem

I'm following the SAFE Stack quick start but the FAKE build script fails:

$ dotnet fake build --target run

But FAKE cannot find the npm binary:

Target          Duration
------          --------
Clean           00:00:00.0053439
InstallClient   00:00:00.1517122   (npm was not found in path. Please install it and make sure it's available from your path. See https://safe-stack.github.io/docs/quickstart/#install-pre-requisites for more info)

Question

By inserting debug messages, it seems that the FAKE build.fsx script resolves the PATH from the hosting Windows, not from the WSL2 Linux environment:

DEBUG: Some "C:\Program Files\Git\usr\bin\ls.EXE"

Sample from the script:

// My Debug
printfn "DEBUG: %A" (ProcessUtils.tryFindFileOnPath "ls")
// The actual script
let npmPath =
    match ProcessUtils.tryFindFileOnPath "npm" with
    | Some path -> path
    | None ->
        "npm was not found in path. Please install it and make sure it's available from your path. "
        + "See https://safe-stack.github.io/docs/quickstart/#install-pre-requisites for more info"
        |> failwith

=> Is it a bug or I'm missing something here? (I'm quite new to .Net and F#)

1 Answers

OK, that was something quite stupid from my side: In a previous mixed Windows + WSL setup I added to bash_aliases a line with alias dotnet=dotnet.exe. I should have removed it when I installed the Linux .Net Core packages

Case closed

Related