学习React-native中遇到的错误
2017-12-14 本文已影响22人
谈小龙
2017.12.14
-
红屏,一堆代码
- 摇晃设备,或者运行
adb shell input keyevent 82
,可以打开开发者菜单 - 点击进入
Dev Settings
- 点击
Debug server host for device
- 输入你电脑的IP地址和端口号(譬如10.0.1.1:8081)
- 回到开发者菜单然后选择
Reload JS
- 摇晃设备,或者运行
-
手机白屏 日志信息:
Couldn't connect to "ws://192.168.30.17:8081/message?device=SM-G9280%20-%206.0.1%20-%20API%2023&app=com.helloproject&clientid=DevSupportManagerImpl", will silently retry
判断电脑的服务没有开启,检查端口信息:
lsof -i:8081
没有输出结果,说明服务没有启动。启动服务
react-native start # 报错 ERROR A non-recoverable condition has triggered. Watchman needs your help! The triggering condition was at timestamp=1513216971: inotify-add-watch(/home/mrtan/react-native/HelloProject/android/.git/objects/9d) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl All requests will continue to fail with this message until you resolve the underlying problem. You will find more information on fixing this at https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch # 报错显示 increase the fs.inotify.max_user_watches sysctl
ss上的解决方案
echo 256 | sudo tee -a /proc/sys/fs/inotify/max_user_instances echo 32768 | sudo tee -a /proc/sys/fs/inotify/max_queued_events echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches watchman shutdown-server
重启
react-native run-android