mac安装beego脚手架遇到的问题

1. 运行环境

  • Mac
  • Go 1.18.5

2. 问题描述?

go get github.com/beego/bee

使用go get安装bee时出现如下错误
go: go.mod file not found in current directory or any parent directory.
‘go get’ is no longer supported outside a module.
To build and install a command, use ‘go install’ with a version,
like ‘go install example.com/cmd@latest’
For more information, see golang.org/doc/go-get-install-depr...
or run ‘go help get’ or ‘go help install’.

3. 如何解决此问题?

讨论数量: 7

克隆一个beego项目,在这个项目根目录安装脚手架

1年前 评论
go: go.mod file not found in current directory or any parent directory.

你好,有错误信息如上,先需要go mod init创建一个项目,然后才能安装。

1年前 评论
neo88948 (楼主) 1年前

试试 go install 代替 go get?

1年前 评论
go env -w GO111MODULE=on

试一试先开启Go module? 再init?

1年前 评论

' go get '在模块之外不再受支持。

要构建和安装一个命令,使用带有版本的“go install”,

比如“去安装example.com/cmd@latest”

欲了解更多信息,请参见golang.org/doc/go-get-install-depr…

或者运行' go help get '或' go help install '。

1年前 评论

非常感谢@苏亦坤 @日出 ,目前问题已经解决

go install github.com/beego/bee/v2@latest

安装成功后,bee脚手架位置:$GO_PAATH/bin/bee 最后将GO_PATH 设置 path

1年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!