You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

gRPC Ruby快速启动失败:DescriptorPool实例无build方法(NoMethodError)

执行gRPC Ruby示例服务器时遇到NoMethodError错误

执行命令ruby greeter_server.rb启动gRPC Ruby示例服务器时,出现以下错误:

ruby greeter_server.rb

/Users/ameynevrekar/grpc/examples/ruby/lib/helloworld_pb.rb:6:in `<top (required)>': undefined method `build' for an instance of Google::Protobuf::DescriptorPool (NoMethodError)

Google::Protobuf::DescriptorPool.generated_pool.build do
                                               ^^^^^^
    from <internal:/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:127:in `require'
    from <internal:/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:127:in `require'
    from /Users/ameynevrekar/grpc/examples/ruby/lib/helloworld_services_pb.rb:20:in `<top (required)>'
    from <internal:/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:127:in `require'
    from <internal:/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:127:in `require'
    from greeter_server.rb:26:in `<main>'

已完成的操作:

  • 安装了grpc和grpc-tools gem:
    • gem install grpc
    • gem install grpc-tools
  • 按照指南克隆了指定版本的仓库并进入示例目录:
    # Clone the repository to get the example code:
    $ git clone -b v1.64.0 --depth 1 --shallow-submodules https://github.com/grpc/grpc
    # Navigate to the "hello, world" Ruby example:
    $ cd grpc/examples/ruby
    

原本预期服务器能正常启动,但实际出现上述错误。


内容的提问来源于stack exchange,提问作者nevrekar_amey

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 08:40:04