【问题标题】:Error when running watchman运行守望者时出错
【发布时间】:2017-03-10 05:37:05
【问题描述】:

当我运行 react-native start 时,我收到以下消息

错误:触发了不可恢复的条件。守望者需要你的帮助! 触发条件为timestamp=1489123194:inotify-add-watch(/var/www/html/eventManager/android/app/src/main/res/mipmap-mdpi) -> 用户对inotify手表总数的限制已达到;增加 fs.inotify.max_user_watches sysctl 在您解决之前,所有请求都将继续失败并显示此消息 根本问题。您将在以下位置找到有关修复此问题的更多信息 https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch

at ChildProcess.<anonymous> (/var/www/html/bookLister/node_modules/fb-watchman/index.js:207:21)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:852:16)
at Socket.<anonymous> (internal/child_process.js:323:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:492:12)

【问题讨论】:

  • 你是在设备还是模拟器中运行?
  • 查看我给出的这个答案,它可以解决你的问题。
  • 是的,我正在使用模拟器

标签: react-native watchman


【解决方案1】:
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

守望者关闭服务器

这个有帮助

【讨论】:

  • 很高兴听到@DamianLattenero
  • 谢谢,帮了大忙。
  • 它也对我有用。但是我每次重置计算机时都需要输入这些命令。有什么永久的方法吗?
  • @JollyRoger mad_greasemonkey 的回答将永久解决问题。我在我的电脑上试了一下,下次启动电脑时就没有出现错误了。
  • 感谢这篇文章。它对我有帮助,但每次我重新启动系统时,我都应该运行这些行!我应该怎么做才能在我的系统上永远解决这个问题?!
【解决方案2】:

只需在终端中运行这些命令:

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  

其他方式在package.json中制作脚本

"scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "flow": "flow",
    "flow-stop": "flow stop",
    "watch-need-help": "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"
  },

在项目目录的终端上运行以下命令

npm run watch-need-help

【讨论】:

    【解决方案3】:

    增加 inotify 限制以增加您可以监控的文件数量的限制。

    $ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
    $ sudo sysctl -p
    

    请通过this了解更多信息

    【讨论】:

      【解决方案4】:

      这个也很有帮助。

      echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_watches  && echo 999999 | sudo tee -a  /proc/sys/fs/inotify/max_queued_events && echo 999999 | sudo tee  -a /proc/sys/fs/inotify/max_user_instances && watchman  shutdown-server
      

      【讨论】:

        【解决方案5】:

        更新

        守望者

        到最新(4.7.0)版本帮助我解决了这个问题。

        【讨论】:

          【解决方案6】:

          对我有用

          watchman watch-del-all
          watchman shutdown-server
          

          这是我关注的link

          【讨论】:

          • 这并不能真正回答问题。如果您有其他问题,可以点击 提问。要在此问题有新答案时收到通知,您可以follow this question。一旦你有足够的reputation,你也可以add a bounty 来引起对这个问题的更多关注。 - From Review
          【解决方案7】:

          这个帮助在 github 问题上找到了它

          echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_watches && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_queued_events && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_instances && watchman shutdown-server && sudo sysctl -p
          

          https://github.com/facebook/watchman/issues/163@eladcandroid [1]

          【讨论】:

            【解决方案8】:

            您可以通过尝试以下解决方案之一来解决它:

            首先通过终端中的代码行并对其进行测试:

            echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_watches  && echo 999999 | sudo tee -a  /proc/sys/fs/inotify/max_queued_events && echo 999999 | sudo tee  -a /proc/sys/fs/inotify/max_user_instances && watchman  shutdown-server
            

            或尝试在项目的根目录中使用“react-native run-android”或“run-ios”,然后(在其他终端)“react-native start”

            否则,调试器页面可能在以前的会话中保持打开状态。完全关闭选项卡,然后在新选项卡中打开调试器解决了这个问题。

            如果上述解决方案均不适用于您,请尝试重新启动您的电脑

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 2017-03-17
              • 2017-03-28
              • 2017-01-05
              相关资源
              最近更新 更多