调用proto文件所生成的js文件来初始化客户端时报这个错
TypeError: Cannot read properties of undefined (reading 'MethodInfo')
出现这个问题的原因是
通过proto生程js文件所用的protoc-gen-grpc-web.exe版本与grpc-web版本不一致所导致的
解决方法:
1,下载最新版exe文件重新生成js文件
下载地址
2, 重新生成js文件 生成方法在上一篇文章
3, 项目中的package.json中"grpc-web": "^1.3.1",
安装该版本,为了防止缓存等各方面原因影响,建议删除整个nodemodules包,然后重新npm install
或者yarn
然后错误就解决了~