美文网首页
学习React-native中遇到的错误

学习React-native中遇到的错误

作者: 谈小龙 | 来源:发表于2017-12-14 11:46 被阅读22次

2017.12.14

  • 红屏,一堆代码

    1. 摇晃设备,或者运行adb shell input keyevent 82,可以打开开发者菜单
    2. 点击进入Dev Settings
    3. 点击Debug server host for device
    4. 输入你电脑的IP地址和端口号(譬如10.0.1.1:8081)
    5. 回到开发者菜单然后选择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

相关文章

网友评论

      本文标题:学习React-native中遇到的错误

      本文链接:https://www.haomeiwen.com/subject/ndahwxtx.html