'Executable named git not found on path:' when running stack - haskell-stack

After a recent change in the repository that I am working, I can no longer build. When trying to run any stack command, such as stack build, I get the following error:
$ 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"]
It seems that my stack program does not know the correct path to my git program.
How can I specify my git path to stack?
I have verified that I do have git installed at the following path.
$ which git
/nix/var/nix/profiles/default/bin/git
I am on nixos 17.03.
Edit.
I am sure that the stack build and which git commands were run in the same environment as they were run back to back in the same shell.
My path is
$ 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
This shows the /nix/var/nix/profiles/default/bin is in the path, which contains git.
Also, in my stack.yaml file when I set system-ghc: true I get an 'access rights' error instead of the 'Executable named git not found' error.
$ stack build
Warning: /home/matthew/backup/azara_work/platform/api/stack.yaml: Unrecognized field in NixOptsMonoid: system-ghc
Cloning into '/home/matthew/backup/azara_work/platform/api/.stack-work/downloaded/4FnxEtHDACVR'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Process exited with ExitFailure 128: /nix/var/nix/profiles/default/bin/git clone --recursive git#github.com:seanhess/rollbar-haskell.git /home/matthew/backup/azara_work/platform/api/.stack-work/downloaded/4FnxEtHDACVR

Add this to either ~/.stack/config.yaml
or local stack.yaml (if it already has a nix: block)
nix:
enable: true
packages: [git]

Related

Go install command show 404 error when trying to install module from github

I developed a go module and pushed it to github, when I am trying to install it with the go install command its showing
go: downloading github.com/hvuhsg/lokidbServer v0.0.0-20220825205442-250079f3d6e9
go: github.com/hvuhsg/lokidbServer/cmd/lokidb.go#latest: github.com/hvuhsg/lokidbServer#v0.0.0-20220825205442-250079f3d6e9: verifying module: github.com/hvuhsg/lokidbServer#v0.0.0-20220825205442-250079f3d6e9: reading https://sum.golang.org/lookup/github.com/hvuhsg/lokidb!server#v0.0.0-20220825205442-250079f3d6e9: 404 Not Found
server response:
not found: github.com/hvuhsg/lokidbServer#v0.0.0-20220825205442-250079f3d6e9: invalid version: git ls-remote -q origin in /tmp/gopath/pkg/mod/cache/vcs/023bef7fbf7701c1dd80019746ac35a6d71aa94fa9b3961e0dadef371238a56e: exit status 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.
P.S: the repo is public
The full command is
go install github.com/hvuhsg/lokidbServer/cmd/lokidb.go#latest
You can install it like this:
go install github.com/hvuhsg/lokidbServer/cmd#latest
If the repo is yours, I would recommend adding a folder lokidb to the cmd folder, and put the main package inside of it.
Check this repo as an example:
go install github.com/fraugster/parquet-go/cmd/csv2parquet#latest
Another option is to add a file to the root of the directory, like its done here (in this case, the package inside go.mod is defined as github.com/vektra/mockery/v2):
go install github.com/vektra/mockery/v2#latest

Error while cloning GitHub COSMOS Repository. (GO)

i want to clone and install a GitHub repository but get an error.
git clone https://github.com/bandprotocol/chain
cd chain && git checkout v2.3.0
make install
Result:
..\go\pkg\mod\github.com\rcrowley\go-metrics#v0.0.0-20200313005456-10cdbea86bc0\runtime.go:5:2: found packages pprof (elf.go) and proto (proto.go) in C:\Users\user\go\GO Language\src\runtime\pprof
make: *** [Makefile:24: install] Error 1
If i delete for example one file he takes the next two out of this folder.
Thanks for help and answers

when executing the go get command to install fabric-ca, I'm getting an error

when executing
go get -u github.com/hyperledger/fabric-ca/cmd/
from the fabric-ca guide, I get the following error:
# cd /home/pi/go/src/github.com/hyperledger/fabric-ca; git pull --ff-only
error: cannot open .git/FETCH_HEAD: Permission denied
package github.com/hyperledger/fabric-ca/cmd: exit status 1`
I tried git cloning and it downloaded everything from the fabric-ca repository, then I tried installing fabric-server and client by myself like this:
sudo make fabric-ca-server
this also produced the following error:
Building fabric-ca-server in bin directory ...
/bin/sh: 1: go: not found
Makefile:91: recipe for target 'bin/fabric-ca-server' failed
make: *** [bin/fabric-ca-server] Error 127
Looks like your GOPATH is set to /home/pi/go and appears that you do not have access to somewhere along the path to /home/pi/go/src/github.com/hyperledger/fabric-ca.
I'd check make sure that the user you are running go get with has R/W access to /home/pi/go/src

Stack and git are incompatible in Windows 7?

I have been using Stack for dependencies management and building system for Haskell programs in Windows 7 Pro without problems.
stack --version
Version 1.3.2, Git revision 3f675146590da4f3edf768b89355f798229da2a5 x86_64 hpack-0.15.0
I have recently installed git for Windows, and Stack cannot download lts files anymore. It seems that Stack is trying using the new git client instead of the internal one.
git --version
git version 2.13.3.windows.1
The error I get when I try to create a new project is the following:
C:\proj>stack new newProject
Downloading template "new-template" to create project "newProject" in newProject\ ...
Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- newProject\newProject.cabal
Selecting the best among 11 snapshots...
Fetching package index ...fatal: Not a git repository: '.git'
Process exited with ExitFailure 128: C:\dev\git\apps\Git\cmd\git.EXE --git-dir=.git fetch --tags
Failed to fetch package index, retrying.
removeDirectoryRecursive: permission denied (Acceso denegado.)
If I rename the directory where git is installed, Stack works again. But that is not a real solution.
Any help will be apreciated

How to include other folders within the #INC for Perl? (Was: `Can't locate Git.pm in #INC` for svn2git)

I am attempting to import an svn repo into git via svn2git. When I run svn2git --verbose https://url_to_repo I end up getting the following output:
Running command: git svn init --prefix=svn/ --no-metadata --trunk=trunk --tags=tags --branches=branches https://url_for_repository
Can't locate Git.pm in #INC (#INC contains: /usr/lib/perl5/site_perl/5.8.8 /home/cpdirect/perl5/lib/perl5 /usr/local/lib/perl5/5.8.8/x86_64-linux /usr/local/lib/perl5/5.8.8 /usr/local/lib/perl5/site_perl/5.8.8/x86_64-linux /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl .) at /usr/libexec/git-core/git-svn line 80.
BEGIN failed--compilation aborted at /usr/libexec/git-core/git-svn line 80.
command failed:
2>&1 git svn init --prefix=svn/ --no-metadata --trunk=trunk --tags=tags --branches=branches https://url_for_repository
It is obvious that Perl is unable to find the module within the path, however everything I've tried so far on CentOS 5.9 has not yielded results. For example, the following are installed:
git-1.7.11.3-1.el5.rf
git-svn-1.7.11.3-1.el5.rf
cpanel-git-1.7.11.3-1.cp1136
Any ideas of how to resolve this issue?
So it turns out that for some reason Perl doesn't know how to look at /usr/lib/perl5/vendor_perl/5.8.8/. If I make links to every module that it needs within /usr/lib/perl5/site_perl/5.8.8 it works seemingly fine and without error.
So the real question here is HOW do you force Perl to look under that vendor_perl folder?
So I've discovered how to add multiple libs and it solves the missing Perl libs:
PERL5LIB="/usr/lib/perl5/vendor_perl/5.8.8/:/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi" svn2git -v file:///my/path/to/svn/repo

Resources