Cannot read property 'name' of undefined @ injectScripts.min.js:1
2016-12-20 08:54
495 查看
前言
最近在准备重构项目的时候无意间发现页面有一处报错:报错代码如下:injectScripts.min.js:1 Uncaught TypeError: Cannot read property 'name' of undefined at t.e._onMessage (injectScripts.min.js:1) at t._onMessage (injectScripts.min.js:1) at injectScripts.min.js:1 e._onMessage @ injectScripts.min.js:1 t._onMessage @ injectScripts.min.js:1 (anonymous) @ injectScripts.min.js:1
虽然这处报错并不影响自己继续写项目,但是每次调试的时候都能看到这条红灿灿的报错消息,身为一个合格的强迫症患者真的已经无法容忍它的存在。
原因分析
根据报错消息我们可以明显的看到,问题出现在injectScripts.min.js文件中,坑爹的是我自己在项目组并没有引入这个文件;然后我怀疑是不是在安装的第三方依赖包引用了该文件,然而通过对整个项目进行检索也并没有找到该文件存在,最后只能分析
html代码结构,功夫不负有心人,终于在代码
head中发现了下面这串代码:
<script src="chrome-extension://oofgjnalpjodkfmfomihdlchiiacnman/injectScripts.min.js"></script>
由于
chrome-extension是
Chrome的扩展管理页,因此我们断定
injectScript.min.js文件来源于
Chrome第三方插件库,下面的问题就好解决了。
具体方法
在console中双击打开
injectScripts.min.js文件,然后再文件中我们发现
egret字样,因此我们可以断定该原因是由于自己安装的
egret游戏引擎的
debug工具导致的。
然后我们打开谷歌扩展程序管理页面,然后关闭
egret插件就可以解决当前页面报错的问题了。
相关文章推荐
- jquery.dataTables.min.js:62 Uncaught TypeError: Cannot read property 'style' of undefined原因
- echarts.min.js:25 Uncaught TypeError: Cannot read property 'features' of undefined
- uploadify的JS组件报错:Uncaught TypeError: Cannot read property 'queueData' of undefined
- Uncaught TypeError: Cannot read property 'call' of undefined jquery.validate.min.js:28
- JS: Cannot read property 'innerHTML' of undefined错误
- aes.js:77 Uncaught TypeError: Cannot read property 'extend' of undefined(…)
- Cannot read property 'nodeName' of undefined
- Uncaught TypeError: Cannot read property 'trigger' of undefined(zepto.js)
- echarts.min.js:25 Uncaught TypeError: Cannot read property 'features' of undefined 报错解决方法
- util.js:68 Uncaught TypeError: Cannot read property 'fn' of undefined
- js中出现Cannot read property 'nodeName' of null
- jquery file upload 报错:Cannot read property 'nodeName' of undefined
- JS —— Uncaught TypeError: Cannot read property 'slice' of undefined 错误
- js问题 Cannot read property 'messages' of undefined
- js提示Cannot read property 'style' of undefined
- AngularJs Type error : Cannot read property 'childNodes' of undefined
- background.js Uncaught TypeError: Cannot read property 'xxx' of undefined
- 关于js页面:cannot read property 'call' of undefined
- Uncaught TypeError: Cannot read property 'call' of undefined jquery.validate.min.js:28
- js的form(load报错jquery.easyui.min.js:2837 Uncaught TypeError: Cannot read property 'tip' of undefined