f# - F# Fake 在 WSL2 中运行可解析宿主 Windows 中的程序路径,而不是 Linux
问题描述
环境
- 来自 Windows 10 家庭版的 WSL2 Ubuntu 20.04
- Linux .Net Core 3.1
- 节点 12.18.3 + NPM 6.14.6 + Yarn 1.22.5
问题
我正在关注SAFE Stack 快速入门,但 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 解析 PATH,而不是从 WSL2 Linux 环境:
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
=> 这是一个错误还是我在这里遗漏了什么?(我对 .Net 和 F# 很陌生)
解决方案
好的,从我的角度来看,这很愚蠢:在以前的混合 Windows + WSL 设置中,我添加到bash_aliases
带有alias dotnet=dotnet.exe
. 我应该在安装 Linux .Net Core 软件包时删除它
结案
推荐阅读
- xcode - 在目标 [Xcode 11] 之间共享文件夹和文件(如 Utilities.swift 文件)
- gnuplot - gnuplot:来自 url 的数据
- android-studio - 在 Android Studio 中自动完成整行的快捷方式是什么?
- image - Python:使用带有滑块权重的图像更新绘图
- javascript - 如何在 ajax 请求更新 HTML 后使 JavaScript 运行
- sql - 使用排除条件计算出现次数
- sql - 查询将数据转换为开闭对
- google-cloud-platform - BigQuery:用于存储的单独项目和用于查询的项目
- javascript - 在由 dangerouslySetInnerHTML 设置的 HTML 中添加 React 组件
- javascript - 如果值的长度为 0,如何重置 fetch 调用?