Beego安装错误解决(mac)

Beego安装错误解决(mac)

    • 错误1.没有配置GOPATH
    • 错误2.配置好GOPATH后,如出现如下错误,是因为GOPATH的文件夹没有建立,在/usr/local/下建立gopath路径的文件夹即可
    • 错误3.没有配置GOPROXY及GO111MODULE的设置
    • 错误4.可能又报错了,zsh: command not found: bee,将bin目录下bee的路径拷贝添加到环境变量中
    • 运行项目错误解决

/Users/jiaqihu/go/src/github.com/gadelkareem/delve/service/rpccommon/server.go:83:3: cannot use logger (type *“github.com/go-delve/delve/vendor/github.com/sirupsen/logrus”.Entry) as type *“github.com/gadelkareem/delve/vendor/github.com/sirupsen/logrus”.Entry in field value
#github.com/gadelkareem/delve/service/debugger
/Users/jiaqihu/go/src/github.com/gadelkareem/delve/service/debugger/debugger.go:129:3: cannot use logger (type *“github.com/go-delve/delve/vendor/github.com/sirupsen/logrus”.Entry) as type *“github.com/gadelkareem/delve/vendor/github.com/sirupsen/logrus”.Entry in field value

错误1.没有配置GOPATH

/Users/jiaqihu/go/src/github.com/gadelkareem/delve/service/rpccommon/server.go:83:3: cannot use logger (type *“github.com/go-delve/delve/vendor/github.com/sirupsen/logrus”.Entry) as type *“github.com/gadelkareem/delve/vendor/github.com/sirupsen/logrus”.Entry in field value

export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
export GOPATH=/usr/local/gopath

错误2.配置好GOPATH后,如出现如下错误,是因为GOPATH的文件夹没有建立,在/usr/local/下建立gopath路径的文件夹即可

package github.com/beego/bee: mkdir /usr/local/gopath: permission denied

错误3.没有配置GOPROXY及GO111MODULE的设置

/Users/jiaqihu/go/src/github.com/gadelkareem/delve/service/debugger/debugger.go:129:3: cannot use logger (type *“github.com/go-delve/delve/vendor/github.com/sirupsen/logrus”.Entry) as type *“github.com/gadelkareem/delve/vendor/github.com/sirupsen/logrus”.Entry in field value

// An highlighted block
go env -w GOPROXY=https://goproxy.io,direct
go env -w GO111MODULE=on

执行完毕后再次安装bee

go get -u github.com/beego/bee 

安装完毕输入bee

错误4.可能又报错了,zsh: command not found: bee,将bin目录下bee的路径拷贝添加到环境变量中

sudo vi ~/.bash_profile
export PATH=$PATH:/usr/local/gopath/bin
source .bash_profile 发布环境变量

再次输入bee就ok了


运行项目错误解决

/usr/local/gopath/src/golang.org/x/crypto/acme/autocert (from $GOPATH)

2020/07/17 09:20:13 ERROR ▶ 0003 Failed to build the application: …/github.com/astaxie/beego/staticfile.go:31:2: cannot find package “github.com/hashicorp/golang-lru” in any of:

解决方法:

go mod init

初始化一个go.mod文件到当前目录
https://www.cnblogs.com/dhcn/p/11321376.html

你可能感兴趣的:(Beego安装错误解决(mac))