发现错误
错误内容
undefined is not an object (evaluating \'i.length\')
https://usr//sub-packages/reimburse/app-service.js:4524:2767
https://lib/WASubContext.js:2:66482
https://lib/WASubContext.js:2:66590
e@https://lib/WASubContext.js:2:69042
https://lib/WASubContext.js:2:33161
r@https://lib/WASubContext.js:2:32864
h@https://lib/WASubContext.js:2:112402
https://lib/WASubContext.js:2:113223
https://lib/WASubContext.js:2:95115
https://lib/WASubContext.js:2:101656
这种错误没有指定报错文件来源,我们可以通过以下方法来寻找问题
1、下载线上版本 Source Map 文件
2、安装sourcemap-lookup插件
执行安装命令
npm install sourcemap-lookup -g
3、寻找错误
https://usr//sub-packages/reimburse/app-service.js:4524:2767
关键位置 sub-packages/reimburse
,进入文件夹
在此文件夹执行查找命令
sourcemap-lookup app-service.js:4524:2767
可以看出本次报错是代码 fee_info为undefined的情况下取值了fee_info.length,undefined.length肯定报错,与小程序后台报错
undefined is not an object (evaluating \'i.length\')
也是相匹配的
微信开发者工具下载的 sourcemaps 怎么用【官方解释,可以了解下】
https://developers.weixin.qq.com/community/develop/article/doc/0008643aa54ce81d519ad84735b413