iphone6s中,import socket.io-mp-client库出错,怎么解决?

发布于 6 年前作者 yong624512 次浏览最后编辑 6 年前来自 ask

我们用uni-app开发的小程序,大部分手机(包括安卓和iphone7以上)都能正常工作。在iphone6s,IOS版本为9.3.2。微信是最新的7.0.8版本。在小程序加载的时候出现

SyntaxError

line:7570,column:13838,SyntaxError: Unexpected identifier ‘index’ Stack:[native code]

evaluateScriptFile@https://lib/WAServiceMainContext.js:1:13838

value@https://lib/WAServiceMainContext.js:1:135109

https://lib/WAServiceMainContext.js:1:136856

https://lib/WAServiceMainContext.js:1:132725

https://lib/WAServiceMainContext.js:1:223552

https://lib/WAServiceMainContext.js:1:222520

https://lib/WAServiceMainContext.js:1:222484

https://lib/WAServiceMainContext.js:1:223552

b@https://lib/WAServiceMainContext.js:1:1998

通过查证,发现是由于import Socket from 'socket.io-mp-client’导致。想问问IOS 9.3.2和之后的版本有什么差异导致上面这个问题?是webview模块版本不同吗?还有就是怎么解决这个问题?

2 回复
mchen
mchen1 楼6 年前

麻烦说明微信版本号,提供能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

lei00
lei002 楼4 年前

微信版本号是7.0.8。关于代码,可以去npmjs.org下载一个socket.io-mp-client模块即可。问题出在import Socket from 'socket.io-mp-client’时,报错!