小编Kai*_*sen的帖子

React - 在 chrome 中调试时,出现“文档未定义”错误

我正在尝试在 Chrome 中调试 React Native iOS 项目,我得到一个堆栈跟踪,说明document is not defined. 当我禁用 chrome 调试时,该应用程序工作正常。我在 package.json 中使用 react-native 0.14.2。当我尝试为任何示例应用程序启用调试时,我在 chrome 中遇到相同的错误。我只是从 github 上查看了 react 框架,所以我没有使用“react native”命令。任何想法这里可能有什么问题?下面是启用“Chrome 调试”时我的屏幕外观的红色框。反应下面的红盒图像。谢谢!

当我在 chrome 调试中检查堆栈跟踪时,这是它抛出的行:

require("react-native/Examples/ViroSample/ViroSampleApp.ios.js");
Run Code Online (Sandbox Code Playgroud)

这是完整的堆栈跟踪:

文档未定义
处理异常@ExceptionsManager.js:63
handleError @InitializeJavaScriptAppEngine.js:80
ErrorUtils.reportFatalError @ error-guard.js:28
requireImpl @require.js:31
require @require.js:21
(anonymousfunction)@ViroSampleApp。 ios.js.js:1 messageHandlers.executeApplicationScript
@ debuggerWorker.js:18
onmessage @ debuggerWorker.js:42


更新
违规代码似乎是 ReactErrorUtils.js 中的以下内容,它是 react-haste 模块的一部分:

if (__DEV__) {
  /**
   * To help development we can get better devtools integration by simulating a
   * real browser event.
   */
  if …
Run Code Online (Sandbox Code Playgroud)

javascript debugging google-chrome react-native

5
推荐指数
1
解决办法
1267
查看次数