在WSL2中运行F#Fake Fake解析托管Windows中的程序路径,而不是Linux中的程序路径

问题描述

环境

  • Windows 10 Home中的WSL2 Ubuntu 20.04
  • Linux .Net Core 3.1
  • 节点12.18.3 + NPM 6.14.6 +纱线1.22.5

问题

我正在关注{{3}},但是FAKE构建脚本失败:

$ dotnet fake build --target run

但是FAKE无法找到npm二进制文件

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)

问题

通过插入调试消息,似乎FAKE build.fsx脚本从托管Windows而不是从WSL2 Linux环境解析PATH:

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

脚本示例:

// 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

=>是bug还是我在这里缺少东西?(我对.Net和F#还是很陌生)

解决方法

好的,这在我看来是很愚蠢的:在以前的Windows + WSL混合设置中,我在bash_aliases的行中添加了alias dotnet=dotnet.exe。安装Linux .Net Core软件包时,应该删除它

关闭案例