php - 找不到类“Grpc\BaseStub”
问题描述
尝试运行由protoc
一堆*.proto
文件生成的 PHP 客户端代码。PHP 代码在带有 php7.3 的 docker 容器上运行,并安装并启用了 GRPC 扩展:pecl/grpc is already installed and is the same as the released version 1.23.1
.
当代码运行时,我收到以下错误:Class 'Grpc\BaseStub' not found
.
此行触发了错误:class ProductServiceClient extends \Grpc\BaseStub {
. 这是自动生成代码中的一行,因此无法修改。
[编辑] 运行composer require grpc/grpc
解决了这个问题;但是,我现在有Class 'Google\Protobuf\Internal\Message' not found
.
[编辑] 运行composer require google/protobuf
解决了第二个问题。
解决方案
尝试添加 grpc 库:
composer require grpc/grpc
推荐阅读
- spring-webflux - Webflux:从流内对象添加订阅者上下文值
- excel - Excel 命名范围公式,用于单元格序列
- java - 等待文件附件下载完成
- java - 可以忽略类路径上的配置类吗?
- typescript - 打字稿:为什么`as unknown as x`有效
- mysql - 编写一个 SQL 查询,显示 A、B 和 C 列中每个数字 (1-9) 的频率
- mysql - Dbeaver 无法连接到 docker 内的 azure mysql 数据库
- google-apps-script - 可靠运行的脚本停止写入 Google 表格
- api - 我如何告诉邮递员扫描大于 0 的数字的响应?
- c# - 如何通过代码限制多租户登录到特定租户?