VUE前端项目问题记录
vue、grpc-web
错误描述
user_grpc_web_pb.js:95 Uncaught TypeError: Cannot read properties of undefined (reading 'MethodInfo')
at eval (user_grpc_web_pb.js:95)
at Object../src/pbjs/external/user/user_grpc_web_pb.js (app.js:1186)
at __webpack_require__ (app.js:90)
at eval (index.ts:11)
at Module../src/api/index.ts (app.js:423)
at __webpack_require__ (app.js:90)
at eval (System.vue?./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/ts-loader??ref--13-2!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options:13)
at Module../node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js?!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/views/System.vue?vue&type=script&lang=ts& (app.js:305)
at __webpack_require__ (app.js:90)
at eval (VM25262 System.vue:2)
问题原因
package.json中的npm依赖版本不对
错误的
"grpc-web": "^1.3.0",
"protobufjs": "^6.11.2",
"protoc-gen-grpc-web": "^1.3.0",
与项目匹配的
"grpc-web": "^1.1.0",
"protobufjs": "^6.9.0",