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

Most upvoted comments

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-A then you set up $GOPATH-B and switched to a new path.

$GOPATH-B appears to work correctly in that you have a buffalo command. This is because $GOPATH-A/bin is 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-A and you are looking at $GOPATH-B it 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 $GOPATH is 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.