在uni-app中,我使用npm安装google-protobuf后,HbuilderX编译通过,但是在微信开发者工具中报错,报错如下:
thirdScriptError
sdk uncaught third Error
Cannot read property 'navigator' of undefined
TypeError: Cannot read property 'navigator' of undefined
at Object.push.../../../../Work/Work Document/charging-station-map-app/html/fuzhou-uni-app-project/node_modules/google-protobuf/google-protobuf.js.goog.labs.userAgent.util.getNavigator_ (http://127.0.0.1:29237/appservice/common/vendor.js:1552:492)
at Object.push.../../../../Work/Work Document/charging-station-map-app/html/fuzhou-uni-app-project/node_modules/google-protobuf/google-protobuf.js.goog.labs.userAgent.util.getNativeUserAgentString_ (
经过排查,发现在对module报进行导入时报错:
var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();
goog.exportSymbol('proto.RequestJs', null, global);
本身代码在vue项目中没有任何问题
1***@qq.com (作者)
已查到问题,现已对其重新封装解决
2019-04-17 11:11
蓝调华尔兹
回复 1***@qq.com: 我也正在做这个,出现了一样的问题,请问下是什么原因呢?
2019-08-13 14:20
1***@qq.com
回复 蓝调华尔兹: 请问你解决了吗,同样的问题,需要怎么封装吗
2019-08-27 11:05