Android上的react-native运行教程'AwesomeProject'导致'无法下载JS Bundle'红屏

时间:2015-09-25 13:47:19

标签: android android-emulator reactjs react-native

我正在关注this Facebook教程,当从AwesomeProject目录运行react-native run-android时,我在android模拟器上获得了一个红色屏幕,其中包含以下文字:

  

无法下载JS捆绑包。您是否忘记启动开发服务器或连接设备?   的 onResponse
  DevServerHelper.java:175
  的运行
  NamedRunnable.java:33
  的 runWorker
  ThreadPoolExecutor.java:1113
  的运行
  ThreadPoolExecutor.java:588
  的运行
  Thread.java:818

我不知道它是否相关,但我在服务器上收到一堆语法错误conststrict mode中无效(我在原始代码中没有改变任何内容) )并在START上收到以下错误:

  

<开始>要求:/index.android.bundle平台=机器人
  TypeError:无法读取null的属性“root”           at /Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/packager/react-packager/src/DependencyResolver/crawlers/index.js:16:84
      在tryCallOne(/Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/lib/core.js:37:12)
      at /Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/lib/core.js:103:15
      在flush(/Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)
      at process._tickCallback(node.js:355:11)

更新 升级到Node v4.1.1摆脱了const语法错误,但我仍然得到相同的结果,并在React Packager上出现以下错误:

  

TypeError:无法读取null的属性“root”       at /Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/packager/react-packager/src/DependencyResolver/crawlers/index.js:16:84       在tryCallOne(/Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/lib/core.js:37:12)       at /Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/lib/core.js:103:15       在flush(/Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)       at process._tickCallback(node.js:355:11)   [5:02:20 PM]请求:/index.android.bundle?platform = android   [下午5:02:20]找到依赖关系   TypeError:无法读取null的属性“root”       at /Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/packager/react-packager/src/DependencyResolver/crawlers/index.js:16:84       在tryCallOne(/Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/lib/core.js:37:12)       at /Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/lib/core.js:103:15       在flush(/Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)       at process._tickCallback(node.js:355:11)   [5:02:26 PM]请求:/index.android.bundle?platform = android

2 个答案:

答案 0 :(得分:3)

我设法解决了这个问题。对于遇到这个问题的任何人来说,重新安装看门人为我做了诀窍:
brew uninstall watchman
brew install watchman

我的应用现在正在运行

答案 1 :(得分:0)

此外,我尝试了Wathman安装/卸载路线,运气不佳。 做了的工作是确保我更新并更改了 nvm 使用的节点版本。

e.g。 nvm install 4.1.1