微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Watchman React Native不断刷新客户端

如何解决Watchman React Native不断刷新客户端

我遇到一个问题,我认为Watchman会继续重新抓取我的项目。基本上,我的React Native应用程序在模拟器上每隔约10秒钟不断刷新一次。

在Metro中,我一遍又一遍地看到以下内容

[2020年10月23日星期五11:13:33.189] Bundle ./index.js

[2020年10月23日星期五11:13:38.681]日志使用{“ roottag”:1}运行“ myProject”

[2020年10月23日星期五11:14:09.434] Bundle ./index.js

[2020年10月23日星期五11:14:11.666]日志中运行带有{“ roottag”:21}的“ myProject”

我尝试过的事情:

已安装inotify:

sudo pacman -Syu

sudo pacman -S inotify-tools

上载了inotify:

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

哪些给了我以下内容

❯ cat /proc/sys/fs/inotify/max_user_instances
999999
❯ cat /proc/sys/fs/inotify/max_user_watches
999999
❯ cat /proc/sys/fs/inotify/max_queued_events
999999

在/etc/sysctl.conf中使其永久存在

vm.nr_hugepages = 2048
fs.inotify.max_user_watches = 999999
fs.inotify.max_queued_events = 999999
fs.inotify.max_user_instances = 999999

尝试:

watchman watch-del-all

watchman shutdown-server

我还尝试运行此清晰的脚本(为我的环境进行了稍微编辑):

https://gist.github.com/jesussteve/45a9251e4d1419283086379e069aed56-包括从客户端删除应用程序并重新启动模拟器。

我还尝试在VS Code内部和通过终端在外部运行yarn startyarn start android。我也禁用了所有扩展。

我的项目不在任何保管箱,Google驱动器,任何类型的云存储目录中。

不确定要做什么!

一些故障排除链接

https://facebook.github.io/watchman/docs/install.html#linux-inotify-limits

https://facebook.github.io/watchman/docs/troubleshooting.html#avoiding-recrawls

https://github.com/facebook/watchman/issues/163

https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers

package.json:

{
  "name": "myProject","version": "0.0.1","private": true,"scripts": {
    "emu": "./emulator.sh","up": "npm-run-all -p start android","start": "yarn react-native start","android": "yarn react-native run-android","server": "node ./server/index.js","clean": "./react-native-clean.sh ./","ios": "yarn react-native run-ios","test": "jest","lint": "eslint ."
  },"dependencies": {
    "@eva-design/eva": "2.0.0","@react-native-community/masked-view": "^0.1.10","@react-navigation/native": "^5.7.6","@react-navigation/stack": "^5.9.3","@ui-kitten/components": "5.0.0","@ui-kitten/eva-icons": "5.0.0","react": "16.13.1","react-native": "0.63.3","react-native-svg":"12.1.0","react-native-screens":"2.11.0","react-native-safe-area-context": "^3.1.8","react-native-gesture-handler":"1.8.0"
  },"devDependencies": {
    "@babel/core": "^7.8.4","@babel/runtime": "^7.8.4","@react-native-community/eslint-config": "^1.1.0","babel-jest": "^25.1.0","eslint": "^6.5.1","jest": "^25.1.0","metro-react-native-babel-preset": "^0.59.0","react-test-renderer": "16.13.1","@ui-kitten/metro-config": "5.0.0","npm-run-all": "^4.1.5","prettier": "^2.1.2"
  },"jest": {
    "preset": "react-native"
  }
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?