執行 kratos 一直沒這個命令,提示 'kratos' 不是內部或外部命令,也不是可執行的程式,需要配置go-bin

wangchunbo發表於2021-07-23

問題

已經安裝成功

執行 kratos 一直沒這個命令,提示 沒有這命令,需要配置go-bin

但是無法執行 kratos new kratos-demo

λ kratos new helloworld
'kratos' 不是內部或外部命令,也不是可執行的程式
或批處理檔案。

提示沒有這個命令.

解決

配置go-bin

執行 kratos 一直沒這個命令,提示 沒有這命令,需要配置go-bin

終極方案

如果還是沒解決,那麼開啟你的 gobin 目錄.
先檢視有沒有 kratos.exe. 如果沒有,請你 重新go get

執行 kratos 一直沒這個命令,提示 沒有這命令,需要配置go-bin

有的話.
直接把這個路徑放到 環境變數的path

執行 kratos 一直沒這個命令,提示 沒有這命令,需要配置go-bin

解決後,再次執行 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

建立成功:

執行 kratos 一直沒這個命令,提示 沒有這命令,需要配置go-bin

本作品採用《CC 協議》,轉載必須註明作者和本文連結
感謝關注 上海PHP自學中心-免費程式設計視訊教學|

相關文章