问题
已经安装成功
kratos new kratos-demo
λ kratos new helloworld
'kratos' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
提示没有这个命令.
解决
配置go-bin
终极方案
如果还是没解决,那么打开你的 gobin 目录.
先查看有没有 kratos.exe. 如果没有,请你 重新go get
有的话.
直接把这个路径放到 环境变量的path
解决后,再次执行 kratos new demo
执行情况 如下,创建成功.
λ kratos new demo
� Creating service demo, layout repo is https://github.com/go-kratos/kratos-layout.git, please wait a moment.
Cloning into 'C:\Users\admin/.kratos/repo/github.com/go-kratos/kratos-layout@main'...
remote: Enumerating objects: 729, done.
remote: Counting objects: 100% (295/295), done.
remote: Compressing objects: 100% (136/136), done.
Receiving objects: 98% (715/729)eused 191 (delta 140), pack-reused 434eceiving objects: 97% (708/729)
Receiving objects: 100% (729/729), 195.70 KiB | 1.72 MiB/s, done.
Resolving deltas: 100% (366/366), done.
CREATED F:\work\go\src\demo\.gitignore (564 bytes)
CREATED F:\work\go\src\demo\Dockerfile (483 bytes)
CREATED F:\work\go\src\demo\LICENSE (1087 bytes)
CREATED F:\work\go\src\demo\Makefile (2158 bytes)
CREATED F:\work\go\src\demo\README.md (1142 bytes)
CREATED F:\work\go\src\demo\api\helloworld\v1\error_reason.pb.go (5606 bytes)
CREATED F:\work\go\src\demo\api\helloworld\v1\error_reason.pb.validate.go (580 bytes)
CREATED F:\work\go\src\demo\api\helloworld\v1\error_reason.proto (424 bytes)
CREATED F:\work\go\src\demo\api\helloworld\v1\error_reason.swagger.json (887 bytes)
CREATED F:\work\go\src\demo\api\helloworld\v1\error_reason_errors.pb.go (982 bytes)
CREATED F:\work\go\src\demo\api\helloworld\v1\greeter.pb.go (8454 bytes)
CREATED F:\work\go\src\demo\api\helloworld\v1\greeter.pb.validate.go (3904 bytes)
CREATED F:\work\go\src\demo\api\helloworld\v1\greeter.proto (719 bytes)
CREATED F:\work\go\src\demo\api\helloworld\v1\greeter.swagger.json (1937 bytes)
CREATED F:\work\go\src\demo\api\helloworld\v1\greeter_grpc.pb.go (3552 bytes)
CREATED F:\work\go\src\demo\api\helloworld\v1\greeter_http.pb.go (2213 bytes)
CREATED F:\work\go\src\demo\cmd\demo\main.go (1708 bytes)
CREATED F:\work\go\src\demo\cmd\demo\wire.go (575 bytes)
CREATED F:\work\go\src\demo\cmd\demo\wire_gen.go (1057 bytes)
CREATED F:\work\go\src\demo\configs\config.yaml (281 bytes)
CREATED F:\work\go\src\demo\generate.go (59 bytes)
CREATED F:\work\go\src\demo\go.mod (467 bytes)
CREATED F:\work\go\src\demo\go.sum (20446 bytes)
CREATED F:\work\go\src\demo\internal\biz\README.md (7 bytes)
CREATED F:\work\go\src\demo\internal\biz\biz.go (134 bytes)
CREATED F:\work\go\src\demo\internal\biz\greeter.go (715 bytes)
CREATED F:\work\go\src\demo\internal\conf\conf.pb.go (21967 bytes)
CREATED F:\work\go\src\demo\internal\conf\conf.proto (796 bytes)
CREATED F:\work\go\src\demo\internal\data\README.md (8 bytes)
CREATED F:\work\go\src\demo\internal\data\data.go (489 bytes)
CREATED F:\work\go\src\demo\internal\data\greeter.go (536 bytes)
CREATED F:\work\go\src\demo\internal\server\grpc.go (1153 bytes)
CREATED F:\work\go\src\demo\internal\server\http.go (1157 bytes)
CREATED F:\work\go\src\demo\internal\server\server.go (158 bytes)
CREATED F:\work\go\src\demo\internal\service\README.md (11 bytes)
CREATED F:\work\go\src\demo\internal\service\greeter.go (886 bytes)
CREATED F:\work\go\src\demo\internal\service\service.go (142 bytes)
CREATED F:\work\go\src\demo\third_party\README.md (15 bytes)
CREATED F:\work\go\src\demo\third_party\errors\errors.proto (428 bytes)
CREATED F:\work\go\src\demo\third_party\google\api\annotations.proto (1082 bytes)
CREATED F:\work\go\src\demo\third_party\google\api\http.proto (15515 bytes)
CREATED F:\work\go\src\demo\third_party\google\api\httpbody.proto (2748 bytes)
CREATED F:\work\go\src\demo\third_party\protoc-gen-openapiv2\options\annotations.proto (1798 bytes)
CREATED F:\work\go\src\demo\third_party\protoc-gen-openapiv2\options\openapiv2.proto (25415 bytes)
CREATED F:\work\go\src\demo\third_party\validate\README.md (84 bytes)
CREATED F:\work\go\src\demo\third_party\validate\validate.proto (32133 bytes)
� Project creation succeeded demo
� Use the following command to start the project �:
$ cd demo
$ go generate ./...
$ go build -o ./bin/ ./...
$ ./bin/demo -conf ./configs
� Thanks for using Kratos
� Tutorial: https://go-kratos.dev/docs/getting-started/start
创建成功:
本作品采用《CC 协议》,转载必须注明作者和本文链接