ReactJS |应用程序无法在IOS和IE / Edge上运行

问题描述 投票:-1回答:1

版本边缘:微软Edge 44.18362.449.0Microsoft EdgeHTML 18.18362

版本IE:11.592.18362.0

希望我们可以快速地将其排序:

我的reactjs项目在构建和部署后正在chrome和firefox上运行-在Windows和android上。但是,在IE,Edge和Safari(在IOS上也是chrome)上,我得到了一个空白页面,显示以下错误:

对于IE:

TypeError: Unable to get property 'index' of undefined or null reference
   {
      [functions]: ,
      __proto__: { },
      description: "Unable to get property 'index' of undefined or null reference",
      message: "Unable to get property 'index' of undefined or null reference",
      name: "TypeError",
      number: -2146823281,
      stack: "TypeError: Unable to get property 'index' of undefined or null reference
   at value (https://xxxx/static/js/main.9016f2a2.chunk.js:1:2786)
   at Za (https://xxxx/static/js/2.97b2c280.chunk.js:2:331602)
   at Ja (https://xxxx/static/js/2.97b2c280.chunk.js:2:331451)
   at ju (https://xxxx/static/js/2.97b2c280.chunk.js:2:366905)
   at Nl (https://xxxx/static/js/2.97b2c280.chunk.js:2:351180)
   at Al (https://xxxx/static/js/2.97b2c280.chunk.js:2:351108)
   at wl (https://xxxx/static/js/2.97b2c280.chunk.js:2:348431)
   at gl (https://xxxx/static/js/2.97b2c280.chunk.js:2:345175)
   at oc (https://xxxx/static/js/2.97b2c280.chunk.js:2:373109)
   at Anonymous function (https://xxxx/static/js/2.97b2c280.chunk.js:2:374484)",
      Symbol()_6.wutlnu1cxkj: undefined,
      Symbol(react.async_mode)_y.wutlnu1cxkj: undefined,
      Symbol(react.concurrent_mode)_x.wutlnu1cxkj: undefined,
      Symbol(react.context)_o.wutlnu1cxkj: undefined,
      Symbol(react.element)_i.wutlnu1cxkj: undefined,
      Symbol(react.forward_ref)_p.wutlnu1cxkj: undefined,
      Symbol(react.fragment)_k.wutlnu1cxkj: undefined,
      Symbol(react.fundamental)_u.wutlnu1cxkj: undefined,
      Symbol(react.lazy)_t.wutlnu1cxkj: undefined,
      Symbol(react.memo)_s.wutlnu1cxkj: undefined,
      Symbol(react.portal)_j.wutlnu1cxkj: undefined,
      Symbol(react.profiler)_m.wutlnu1cxkj: undefined,
      Symbol(react.provider)_n.wutlnu1cxkj: undefined,
      Symbol(react.responder)_v.wutlnu1cxkj: undefined,
      Symbol(react.scope)_w.wutlnu1cxkj: undefined,
      Symbol(react.strict_mode)_l.wutlnu1cxkj: undefined,
      Symbol(react.suspense)_q.wutlnu1cxkj: undefined,
      Symbol(react.suspense_list)_r.wutlnu1cxkj: undefined
   }

边缘:

TypeError: Unable to get property 'index' of undefined or null reference

SCRIPT5007: SCRIPT5007: Unable to get property 'index' of undefined or null reference

侧面有趣的事实:在删除我的Header组件导入(以进行故障排除)之前,出现了相同的消息,但它不是index,而是说header。我没有称为索引的组件。除了启动index.js。因此,我假设reactjs在这些浏览器中有一个基本问题。我认为它在获取文件结构反应生成方面存在问题吗?

我尝试过polyfill和core-js / stable,两者在结果上都没有区别。

**不幸的是,我无法访问Ipad上的任何开发人员工具来获取ios chrome和safari的控制台日志。我认为这是同样的问题。

javascript reactjs internet-explorer safari microsoft-edge
1个回答
0
投票
我找到了臭虫

几乎放弃后,我找到了解决方案。我一直在逐个重建项目,npm install for npm install,代码块,代码块,直到我终于找到问题为止:const language = navigator.language || navigator.userLanguage;

是的,一行代码破坏了整个项目。您会看到,使用导航器获取浏览器语言时,chrome和firefox返回不同的值。

在我的情况下,Chrome和Firefox返回en,而Edge返回en-DE

[因此,当使用JSON时,json打破了参考。因此

“无法获得未定义或空引用的属性'索引'”

在删除我的Header组件导入(以进行故障排除之前)与此相同消息来了,但不是标头,而是标头。我没有组件称为索引。除了启动index.js。因此我假设在这些浏览器中,reactjs存在一个基本问题。我认为它有文件结构反应生成的问题?

当我像这样在json中引用语言时:

my_json[language]["index"]

索引是页面选择器,并且看起来好像它与选择器位于时的组件有关

my_json[language]["header"]

所以我实际上是在正确的轨道上,但是在Edge,IE和Safari中出现的是我的“文件结构/ json结构”。

太近了,但到目前为止。

[这是一段漫长的旅程和谦卑的经历。最后发现这确实让我开心!谢谢那些至少读了这个问题的人。


找到此错误消息后,就可以理解了,但是目前无法缩小范围。弹出组件名称也使这成为了一段时间的猎巫。

That pretty much sums it up.

© www.soinside.com 2019 - 2024. All rights reserved.