Beego(Golang):在Windows上通过CLI创建新项目

huangapple go评论83阅读模式
英文:

Beego (Golang): Create new project via CLI in Windows

问题

我想使用Beego web框架进行开发。在命令行中,可以通过一个简单的命令来设置一个新的项目目录。如果我在Windows的PowerShell中运行以下命令,会出现错误,因为该命令未知:

bee new beego_project

我该如何注册这个命令以便使用它?

英文:

I wanted to play with the Beego webframework. A simple command in the shell can setup a new project directory. If I run the following commandin Window's Powershell I get an error, because the command is unknown:

bee new beego_project

How can I register this command to make use of it?

答案1

得分: 2

请确保您的Powershell设置中正确设置了环境变量。

例如,可以参考“如何在Powershell中修改GOPATH”的链接。

  • 需要设置GOPATH
  • 需要将%GOPATH%\bin添加到PATH中,并且bee必须在该文件夹中。

请注意,您可以在%USERPROFILE%\Documents\WindowsPowerShell\Profile.ps1中设置这些变量,这类似于~\.bashrc

在评论中,OP补充道:

> 我只需要将%GOPATH%\bin添加到%PATH%变量中。
现在它也在%GOPATH%下工作了。

英文:

Make sure your environment variables are correctly set in your Powershell setup.
See for instance "how to modify GOPATH in powershell"

  • GOPATH needs to be set
  • %GOPAHT%\bin needs to be added to the PATH and bee must be in that folder.

Note that you can set those variables in your %USERPROFILE%\Documents\WindowsPowerShell\Profile.ps1, which is similar to a ~\.bashrc.

The OP adds in the comments:

> I just needed to add %GOPATH%\bin to the %PATH% variable.
Now it works also under %GOPATH%

huangapple
  • 本文由 发表于 2015年2月6日 19:07:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/28364388.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定