Home:ALL Converter>F# Fake run in WSL2 resolves the program path in the hosting Windows, not in Linux

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

Ask Time:2020-08-29T10:22:48         Author:Digital Stoic

Json Formatter

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#)

Author:Digital Stoic,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/63642831/f-fake-run-in-wsl2-resolves-the-program-path-in-the-hosting-windows-not-in-lin
yy