[beego]在 Windows 8 的环境下面一直都是无法正常编译

2023-12-11 348 views
6

PS D:\Go\src\git.aishandai.com\pantao\shandai> ls

目录: D:\Go\src\git.aishandai.com\pantao\shandai

Mode LastWriteTime Length Name


d---- 2013/10/16 13:03 conf d---- 2013/10/16 13:03 controllers d---- 2013/10/16 13:03 models d---- 2013/10/16 13:03 static d---- 2013/10/16 13:03 views -a--- 2013/10/16 13:03 182 main.go

PS D:\Go\src\git.aishandai.com\pantao\shandai> bee run shandai 2013-10-16 02:00:17 [INFO] Initializing watcher... 2013-10-16 02:00:17 [TRAC] Directory( D:\Go\src\git.aishandai.com\pantao\shandai\controllers ) 2013-10-16 02:00:17 [TRAC] Directory( D:\Go\src\git.aishandai.com\pantao\shandai\models ) 2013-10-16 02:00:17 [TRAC] Directory( D:\Go\src\git.aishandai.com\pantao\shandai ) 2013-10-16 02:00:17 [INFO] Start building...

git.aishandai.com/pantao/shandai

.\main.go:4: can't find import: "git.aishandai.com/pantao/shandai/controllers" 2013-10-16 02:00:19 [ERRO] ============== Build failed ===================

回答

3

无法编译通过,提示是找不到包,你是不是gopath没设置对啊

2

没有啊,所有的都设置了的,我是直接使用

go get github.com/astaxie/beego
go get github.com/astaxie/bee

然后直接创建下面这个目录:

D:\Go\src\git.aishandai.com\pantao

然后进入这个目录里面:

bee new shandai

再进入 shandai 这个目录

bee run shandai

就出现上面这个错误了

3

OMG~我也是这种错误~ win8 64 GOARCH=amd64 GOBIN=F:\gopath\bin GOOS=windows GOPATH=F:\gopath GOROOT=F:\Go

Path=D:\Program Files\Sencha\Cmd\4.0.0.203;C:\Windows\system32;C:\Windows;C:\Win dows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files\ Java\jdk1.7.0_40\bin;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Python27;F:\G o\bin;F:\gopath\bin;C:\Program Files (x86)\Git\cmd;C:\Program Files\TortoiseHg\; C:\Ruby193\bin

这可如何是好啊

1

你执行bee的目录对么? 需要在$GOPATH\src\shandai目录中执行bee run shandai

BTW:我也是win8,完全正常

6

我在

src
src/git.aishandai.com/
src/git.aishandai.com/pantao
src/git.aishandai.com/pantao/shandai

这几个里面都运行过了,木有用

2
$GOPATH\src\git.aishandai.com/pantao/shandai/controllers

这个里面话说有文件么?package是用的controllers吗?

9

整个流程:

  1. 安装 beego 与 bee

    go get github.com/astaxie/beego
    go get github.com/astaxie/bee
  2. 创建应用

    cd $GOPATH/src/git.aishandai.com/pantao
    bee new shandai
    cd shandai
  3. 运行应用

    bee run shandai
5

win8 32位没问题,64位出现问题。。。。OMG。。。。

3

估计是Go在win8下面的bug

2

你们可以测试一下其他的相对路径的代码,我觉得这个可能是Go在win8下的bug

4

应该是配置问题吧,我一直在win8 x64下工作,没有任何问题,交叉编译也是正常的

2

我没有win8所以没办法测试,既然楼上同学一直在用是正常的,那说明是自己配置问题啊

1

win8 64位,使用管理员运行命令行(win+x)在运行bee run,没问题...

8

不需要管理员权限的,,,,,你确实配置有问题,,,,

6

事先执行go install 即可。不知道是什么原因。

2

这是window8的问题,已经在大群里面很多人遇到这个问题了

5

我也遇到相同的问题。感谢@Khaki的回答,执行go install后可以了。

1

怎么执行go install?

7

我这里运行sample中的webim例子,bee run后报找不到package controllers的错 也是设置好了gopath 不知道为什么 win8 64 位系统

7

@juneybw 在cmd中,到beego目录下执行go install 命令。

go install compile and install packages and dependencies