react-native red screen error

2019-09-06 15:37发布

问题:

I have installed new application from git but i'm having this red screen error can some one help me out.

   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

this output is adb logcat.

I have created the github issue any one can refer isssue

回答1:

Did you run adb reverse tcp:8081 tcp:8081 as suggested in the error message? You always need to execute this after connecting a physical device, and you might need to do the same for Genymotion (never used it with React).

Also make sure that you have no other process running on port 8081: sudo lsof -n -i4TCP:8081 | grep LISTEN. If you do, you can either kill that process by executing kill -9 <PID>, or start packager on another port: react-native start --port 8082.

If this doesn't help try to open the app on a basic Android emulator instead of Genymotion to see if you get the same error or not.



回答2:

My problem is mismatch of the native-base module in react-native when i upgraded. checkout this issue and also do npm clean cache.

I also deleted node_module and reinstalled.

I went with native-base": "0.5.15" react-native : "0.33.1" and react is "15.3.1" and everything started working fine.

check this also facebook troubleshoot