Documentation
Troubleshooting
App Crashes with securecookie: hash key is not set
After a recent change in the github.com/gorilla/sessions Buffalo applications will fail to start with the error securecookie: hash key is not set
. To fix this you must set an environment variable named SESSION_SECRET
.
For information see https://github.com/gobuffalo/buffalo/issues/1067
Command line is slow
buffalo --help
or any other command from the terminal takes longer than expected set export BUFFALO_PLUGIN_PATH=$GOPATH/bin
in your shell config (e.g. .bash_profile).
Can’t find buffalo
binary.
buffalo
binary after a successful installation, this is problably caused because $GOPATH/bin
, or %GOPATH\bin
(Windows), isn’t in your $PATH
variable. When a Go binary is installed it is placed in $GOPATH/bin
. Adding this to your global $PATH
will allow you to find any Go binary everywhere in your system. See https://golang.org/doc/code.html#GOPATH for more details.
buffalo new
fails to generate a complete project.
This happens because the buffalo new
command cannot find the templates it needs to generate a new application.
There are a couple of things that could cause this issue.
- Using multiple
$GOPATH
s. This can happen when you install Buffalo to one$GOPATH
and then create a new, temporary,$GOPATH
and try to create a new application there. Because the templates are in the first, original$GOPATH
, the installer does not find them, and subsequently generates an incomplete application. To fix this, use just one$GOPATH
. - Using a single
$GOPATH
. If you aren’t using multiple$GOPATH
s and are still seeing this issue, it is most likely caused by a bad installation. Run$ go get -u -v github.com/gobuffalo/buffalo/buffalo
again, and it should, hopefully, repair the installation for you.
The original ticket for this issue can be found at https://github.com/gobuffalo/buffalo/issues/629.
buffalo new
fails with NPM permissions issues.
buffalo dev
auto rebuild doesn’t work with NFS.
fsnotify
package not supporting NFS. See github.com/gobuffalo/buffalo/issues/620 for more details and a workaround.
buffalo new
fails with import path does not begin with hostname
This is caused by a mismatched $GOPATH
and file system.
GOPATH: /Users/foobar/Documents/Programming/Go
ACTUAL: /Users/foobar/Documents/programming/go
Those are not the same and cause problems with a lot of Go tools. Correct the $GOPATH
to match the file system and retry.
buffalo new
fails looking for golang.org/x/tools/go/gcimporter
This is caused by an outdated copy of the github.com/motemen/gore
package. To fix simply update gore
:
$ go get -u github.com/motemen/gore
For information see https://github.com/gobuffalo/buffalo/issues/108 and https://github.com/motemen/gore/issues/63.
buffalo dev
fails to start with Unknown
When starting $ buffalo dev
, and you encounter this error:
There was a problem starting the dev server: Unknown, Please review the troubleshooting docs.
This may be due to your system missing NodeJS/NPM, Ensure that Node/NPM is installed and is in your $PATH
. If Node/NPM are indeed in your $PATH
, try renaming webpack.config.js.
If you are still having issues after attempting the steps above, please reach out to the community in the #buffalo channel on Gophers Slack.
package context: unrecognized import path "context" (import path does not begin with hostname)
When trying to install Buffalo go get
returns this error:
package context: unrecognized import path "context" (import path does not begin with hostname)
This is due to an outdated version of Go. Buffalo requires Go 1.7 or higher. Please check your installation of Go and ensure you running the latest version.
Error: unexpected directory layout:
during go get
Occasionally when running go get
on Buffalo you will get the following error:
unexpected directory layout:
import path: github.com/mattn/go-colorable
dir: /go/src/github.com/fatih/color/vendor/github.com/mattn/go-colorable
expand dir: /go/src/github.com/fatih/color/vendor/github.com/mattn/go-colorable
separator: /
This issue has been reported previously the Go team, github.com/golang/go/issues/17597.
The best way to solve this problem is to run go get
again, and it seems to fix itself.
Error: in application.js
from UglifyJs
buffalo build
you need to update your webpack.config.js
to work with https://github.com/gobuffalo/buffalo/pull/350/files.
Error: Killed 9
when running buffalo
on Mac OS X with Go 1.8.0
This is a known issue with Go, github.com/golang/go/issues/19734, not with Buffalo.
The best solution is to upgrade to Go 1.8.1, or greater, and rebuild your Go binaries.
Mac OS X: Too many open files in system
error
buffalo dev
that means you are “watching” too many files, either .go
files or asset files. To correct this you can change the maximum number of open files on your system.
buffalo new
fails trying to run goimports
The full error may appear something like the following, and seems to be the result of outdated go tools. To resolve run rm -r $GOPATH/src/golang.org/
, then run go get
again.
$ buffalo new myapp
--> go get -u golang.org/x/tools/cmd/goimports
package golang.org/x/tools/cmd/goimports: golang.org/x/tools is a custom import path for https://go.googlesource.com/tools, but /Users/foo/go/src/golang.org/x/tools is checked out from https://code.google.com/p/go.tools
Error: exit status 1
buffalo g goth
fails to generate auth.go
You might see errors similar to this when you build:
buffalo: 2018/01/19 20:58:47 === Error! ===
buffalo: 2018/01/19 20:58:47 === exit status 2
path/path/models
path/path/actions
# path/path/actions
actions/app.go:17:2: gothic redeclared as imported package name
previous declaration at actions/app.go:15:2
actions/app.go:66:36: undefined: AuthCallback
actions/app.go:67:11: undefined: SetCurrentUser
actions/app.go:68:11: undefined: Authorize
actions/app.go:69:23: undefined: Authorize
This could be because the goth
plugin isn’t able to find the templates for the different providers. This can happen when the goth
plugin is available in $PATH
, but the project isn’t in your current $GOPATH
.
To fix it, you can either go get -u github.com/gobuffalo/buffalo-goth
in your project’s $GOPATH
or use dep
.