buffalo: Error: you need to be inside your buffalo project path to run this command
I am getting error below while running buffalo dev and buffalo generate on a fresh buffalo new project.
Error: you need to be inside your buffalo project path to run this command
Buffalo Version
v0.9.4
Go Version
go version go1.9 linux/amd64
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 21 (9 by maintainers)
Commits related to this issue
- use packr to manage templates for generators. hopefully this fixes issues like #629 — committed to gobuffalo/buffalo by markbates 6 years ago
- Merge pull request #879 from gobuffalo/use-packr-for-generator-templates use packr to manage templates for generators. hopefully this fixes issues like #629 — committed to gobuffalo/buffalo by markbates 6 years ago
I can confirm that if you use multiple
$GOPATHs, or you change your$GOPATH, then this will happen.Here’s what happened. You installed the buffalo source (and generator templates) in
$GOPATH-Athen you set up$GOPATH-Band switched to a new path.$GOPATH-Bappears to work correctly in that you have abuffalocommand. This is because$GOPATH-A/binis set on your$PATH.Because Go doesn’t all you to, automatically, attach static files to a binary, Buffalo has to look for most of the template files on disk (some are generated in Go, which is why they aren’t generated). When it goes to look up where the templates are it goes to
$GOPATH/src/github.com/gobuffalo/buffalo/...to fine the templates folder for the generator, loop through them, and write them out to your project.Normally, this works just fine, however, since those template are all under
$GOPATH-Aand you are looking at$GOPATH-Bit can’t find any templates to copy over. Because of that there are no errors, because it did the right thing (it didn’t find templates, so it didn’t process any templates).The
$GOPATHis a source of much heated debate in the community, partially because these are the sorts of problems that arise all the time.The solution here is to stick with one
$GOPATH, or install Buffalo into the new$GOPATH.I did since I was able to run buffalo db command.