本人vue初学,在一次学习过程中加入了另外的一些文件。终端弹出一些warning,到控制台看到以下的错误提示。
实属头疼啊,现在的水平只能看到了 xxx is not a function. 点击定位到app.js的地方也很难理解。有懂的大哥可以指导下这样的错误如何调试为好。。。
问题分析:
首先我下意识Google了一下这第一个unref在vue中是个什么函数,出现这个错误的原因是什么。
可以查到这是一个与Node.js定时器相关的函数,除此之外,并不能搜到错误相关的信息。
然后我仔细看了下终端提示的warning:
可以看到: xxx was not found in 'vue'. 并且错误都出自于一个文件@vant下。
结合上面浏览器控制台的错误,大胆猜测是由于vant依赖包版本问题,导致一些函数经历版本被修改了。
再查看资料里的配置文件:
我的package.json里vant依赖包的版本:
解决方法:
也许是依赖包的问题? 添加上对应版本的vant尝试一下:
yarn add vant@2.12.15
安装完之后再yarn serve一下,终于能看到一抹清新的绿色和一片干净的控制台了 。