GO 解决使用bee工具,报 bash: bee: command not found

时间:2023-03-10 07:01:04
GO 解决使用bee工具,报 bash: bee: command not found

我最近使用beego时,遇到以下问题:command not found
使用vscode时,运行bee run,报以下错

GO 解决使用bee工具,报 bash: bee: command not found

我查到一篇文章csdn,说用拷贝bee.exe方法,我觉得纯扯淡

如何解决?

通常这种情况常在windows出现,苹果还没遇到这个问题,会出现这个问题的环境,往往修改过GOPATH。例如Go 的msi安装是默认会把环境变量配置好,但是我们不想把源码放在C盘,因此改动GOPATH,那就有可能出现以上问题。

1. 首先,我把GOPATH改了,变为以下(我的电脑,右键属性)

GO 解决使用bee工具,报 bash: bee: command not found

GO 解决使用bee工具,报 bash: bee: command not found

要改为哪个盘,随你,第一步可以不做,但是你要知道你的GOPATH事指向哪里的

2.我们在bash中执行以下

$ go get -u github.com/astaxie/beego
$ go get -u github.com/beego/bee

3.接下来,很重要,由于执行了上面两行的命令,因此GOPATH的bin会生成bee.exe

GO 解决使用bee工具,报 bash: bee: command not found

之所以报 command not found,是因为虽然你安装了bee.exe工具,奈何windows找不到,如何设置?

打开系统环境变量,找到path,双击打开,按一下home键,光标就会出现在最前面,设置如下

(你需要设置自己的GOPATH,我的GOPATH是K:\go)

K:\go\bin;

GO 解决使用bee工具,报 bash: bee: command not found

设置完毕 ~

然后,我们再试试

GO 解决使用bee工具,报 bash: bee: command not found

vscode:

记得重启vscode!!

GO 解决使用bee工具,报 bash: bee: command not found

成功!