air icon indicating copy to clipboard operation
air copied to clipboard

no such file or directory even with `go/bin`

Open whiteRave1234 opened this issue 2 years ago • 3 comments

Hello when I try to run air on my project I got the no such file or directory even though I have exported the go/bin directory

here's the list of my PATH Variables

echo -e ${PATH//:/\\n}

/Users/gagahgk/go/bin
/Users/gagahgk/google-cloud-sdk/bin
/Users/gagahgk/Library/Python/3.8/bin
/Users/gagahgk/.nvm/versions/node/v12.22.8/bin
/opt/local/bin
/opt/local/sbin
/Applications/Sublime Text.app/Contents/SharedSupport/bin
/opt/homebrew/bin
/opt/homebrew/sbin
/usr/local/bin
/System/Cryptexes/App/usr/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Library/Apple/usr/bin
/Users/gagahgk/.fig/bin
/Users/gagahgk/.local/bin

and this is the full logs after running air

  __    _   ___
 / /\  | | | |_)
/_/--\ |_| |_| \_ 1.42.0, built with Go 1.20.1

watching .
watching db
watching db/mocks
watching entity
watching entity/auth
building...
running...
/bin/sh: /Users/gagahgk/Documents/Git: No such file or directory

whiteRave1234 avatar Feb 27 '23 11:02 whiteRave1234

facing the same problem. Go's bin already in the PATH, but air not in go/bin directory after go install github.com/cosmtrek/air@latest

sarkarology avatar Mar 21 '23 05:03 sarkarology

Found the solution.

With the command go install github.com/cosmtrek/air@latest, the binary is getting installed in the home folder: ~/go/bin. Then simply adding the alias: alias air='~/go/bin/air' in the ~/.profile and sourcing it with source ~/.profile does the job for me.

sarkarology avatar Mar 21 '23 06:03 sarkarology

what's your project's full path? I facing the same problem, but I solve it. In my case, system is Mac OS, my project's path has whitespace such like /Users/sal/Documents/code it/hello-go. When I copy my project to path /Users/sal/Documents/study/hello-go, air command is ok.

zhenailuoye1 avatar Aug 22 '23 03:08 zhenailuoye1