'在路径上找不到名为git的可执行文件:'运行堆栈时

时间:2017-08-03 19:39:33

标签: haskell-stack

在我最近工作的存储库发生更改后,我无法再构建。尝试运行任何stack命令时,例如stack build,我收到以下错误:

$ stack build
Executable named git not found on path: ["/home/matthew/.stack/snapshots/x86_64-linux-nix/lts-8.23/8.0.2/bin","/nix/store/kikxl1m9gg1rh9yfi9ly9bkl39zdb6z7-postgresql-9.5.6/bin","/nix/store/xczvw3rlvr1ind8s88i7yx0vasl4gzxm-ghc-8.0.2/bin","/nix/store/sxngsdy5y53j8fkb912hbpgamb2bpv5q-patchelf-0.9/bin","/nix/store/9ngvanddznmrbf74cvy0pmrqimk3i56x-paxctl-0.9/bin","/nix/store/c07gdr6cm43j1cphadzafq185k711vx4-coreutils-8.26/bin","/nix/store/7pyzxi7k5l6nym972gi2nq8s9f9b2q0j-findutils-4.6.0/bin","/nix/store/gjwa02cchnj2r69dlqjixjmdn0ws7f1v-diffutils-3.5/bin","/nix/store/xk38vw7z7bfr8173vdwfrfamxqcaj7hi-gnused-4.4/bin","/nix/store/r6s8rcd28wsk4gwviyc93343bq5zwlqq-gnugrep-3.0/bin","/nix/store/bvs3nyfflhsb75cfn4ff2a6xnksdzx9f-gawk-4.1.3/bin","/nix/store/g3skr3kss1fqqzl5viyg178qbcp4cdky-gnutar-1.29/bin","/nix/store/kdx0bwfy20q6blpgpdb7psbn1y435r56-gzip-1.8/bin","/nix/store/f2fg211g8zy5k624dwx0g7z32cm148mr-bzip2-1.0.6.0.1-bin/bin","/nix/store/adjkz7lhgvl3y3hpkzfsmpk15f0jrnmr-gnumake-4.2.1/bin","/nix/store/lpk84rsbha199vm3k54498lqv2jswqj8-bash-4.4-p5/bin","/nix/store/1hdv6h68f7xy9k0lhxqf26saz0w0r39i-patch-2.7.5/bin","/nix/store/vkbh4xbgxvx3v9813d4kdwv8ggwrp038-xz-5.2.2-bin/bin"]

我的stack程序似乎不知道git程序的正确路径。

如何指定git的{​​{1}}路径?

我已经确认我在以下路径中安装了stack

git

我在nixos 17.03。

编辑。

我确信$ which git /nix/var/nix/profiles/default/bin/git stack build命令在相同的环境中运行,因为它们在同一个shell中重新运行。

我的路径是

which git

这表示$ echo $PATH /home/matthew/bin:/run/wrappers/bin:/run/wrappers/bin:/home/matthew/.nix-profile/bin:/home/matthew/.nix-profile/sbin:/home/matthew/.nix-profile/lib/kde4/libexec:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:/nix/var/nix/profiles/default/lib/kde4/libexec:/run/current-system/sw/bin:/run/current-system/sw/sbin:/run/current-system/sw/lib/kde4/libexec 位于路径中,其中包含/nix/var/nix/profiles/default/bin

此外,在我设置git时的stack.yaml文件中,我收到了“访问权限”错误,而不是“可执行命名的git not found”错误。

system-ghc: true

1 个答案:

答案 0 :(得分:0)

将此添加到~/.stack/config.yaml 或本地stack.yaml(如果它已经有一个nix:block)

   nix:
    enable: true
    packages: [git]