反应原生红屏错误

时间:2016-12-01 05:26:16

标签: android react-native genymotion react-native-android

this is the error我已经从git安装了新应用程序,但是我遇到这个红屏错误可以帮助我。

   ReferenceError: Can't find variable: process (http://10.0.3.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:2506) 
E/unknown:React( 2312): 
E/unknown:React( 2312): Try the following to fix the issue: E/unknown:React( 2312): • Ensure that the packager server is running E/unknown:React( 2312): • Ensure that your device/emulator is connected to your machine and has USB debugging enabled - run 'adb devices' to see a list of connected devices 
E/unknown:React( 2312): • Ensure Airplane Mode is disabled E/unknown:React( 2312): • If you're on a physical device connected to the same machine, run 'adb reverse tcp:8081 tcp:8081' to forward requests from your device 
E/unknown:React( 2312): • If your device is on the same Wi-Fi network, set 'Debug server host & port for device' in 'Dev settings' to your machine's IP address and the port of the local dev server - e.g. 10.0.1.1:8081

此输出为adb logcat。

我创建了github问题,任何人都可以参考isssue

2 个答案:

答案 0 :(得分:1)

您是否按照错误消息中的建议运行了adb reverse tcp:8081 tcp:8081?您总是需要在连接物理设备后执行此操作,并且您可能需要对Genymotion执行相同操作(从未将其与React一起使用)。

还要确保在端口8081上没有运行其他进程:sudo lsof -n -i4TCP:8081 | grep LISTEN。 如果这样做,您可以通过执行kill -9 <PID>来终止该进程,或者在另一个端口上启动packager:react-native start --port 8082

如果这无法帮助您尝试在基本的Android模拟器而不是Genymotion上打开应用程序,以查看是否收到相同的错误。

答案 1 :(得分:0)

当我升级时,我的问题是react-native中的native-base模块不匹配。 checkout this issue也可以npm clean cache

我还删除了node_module并重新安装。

我和native-base": "0.5.15" react-native : "0.33.1" and react is "15.3.1"一起去了,一切都很顺利。

同时检查facebook troubleshoot