React native 反应本机开始给我“的;Watchman错误:挂起的缓存作业太多”; 问题
创建捆绑包时,watchman爬网最初会失败,出现“React native 反应本机开始给我“的;Watchman错误:挂起的缓存作业太多”; 问题,react-native,watchman,React Native,Watchman,创建捆绑包时,watchman爬网最初会失败,出现“太多挂起的缓存作业”,这似乎会减慢捆绑过程: $ react-native start --reset-cache 正在加载依赖关系图…jest-haste映射:看守人爬网失败。使用节点爬虫重试一次 通常情况下,这种情况发生在看守人不在运行时。在项目的根文件夹中创建一个空的.watchmanconfig文件,或者在项目中初始化git或hg存储库 错误:Watchman错误:挂起的缓存作业太多。确保watchman正在为此项目运行。看 此外,这
太多挂起的缓存作业
”,这似乎会减慢捆绑过程:
$ react-native start --reset-cache
正在加载依赖关系图…jest-haste映射:看守人爬网失败。使用节点爬虫重试一次
通常情况下,这种情况发生在看守人不在运行时。在项目的根文件夹中创建一个空的.watchmanconfig
文件,或者在项目中初始化git或hg存储库
错误:Watchman错误:挂起的缓存作业太多。确保watchman正在为此项目运行。看
此外,这些可能是相关的:
- 我可以通过从watch配置中排除
来消除错误node\u模块
- 如果没有错误,捆绑机将在20秒后启动
- 出现错误时,craw需要4秒,但捆绑机在4分钟后启动
watchman监视del all
看守关闭服务器
sudo sysctl-w kern.maxfiles=5242880
sudo sysctl-w kern.maxfilesperproc=524288
看守人配置文件
我将我的.watchconfig
文件设置为额外允许的:
{
"ignore_dirs": [],
"fsevents_latency": 0.5,
"fsevents_try_resync": true
}
值班员日志
根据完整日志,爬网在几秒钟内完成
$tail-f/usr/local/var/run/watchman/coolman state/log
22:08:24193:[客户端=0x7ff4a9686d98:stm=0x7ff4a9b2de00:pid=0]发送错误\响应:挂起的缓存作业太多
22:08:24340:[听众]看守人4.9.0在coolman上启动
22:08:24341:[侦听器]路径/Users/coolman/project/react本机应用程序位于文件系统类型apfs上
22:08:24342:[侦听器]root/Users/coolman/project/react本机应用程序使用监视机制fsevents(请求自动)
22:08:24344:[侦听器]文件限制为2560 kern.maxfilesperproc=524288
22:08:24344:[侦听器]将文件限制提高到524288
22:08:24345:[侦听器]启动:套接字中不存在“sock”
22:08:28805:[io 0x7F87BA00818/Users/coolman/project/react native app]性能:{“ru_nvcsw”:1460,“ru_nsignals”:0,“ru_msgrcv”:0,“ru_msgsnd”:0,“ru_inblock”:0,“ru_majflt”:0,“ru_minflt”:28103,“ru_ixrs”:0,“ru_maxrss”:1151098888,“系统时间”:2.934997000000001,“用户时间”:1.327971,“ru时间”:4.4614079999996,“pid”:29414,“ru_idrss”:0,“meta”:{“root”:{“watcher”:“fsevents”,“ticks”:2,“number”:1,“区分大小写”:false,“recrawl_count”:0,“path”:“/Users/coolman/project/react native app”},“version”:“4.9.0”,“ru_oublock”:0,“ru nivcsw”:2171,“start_time”:1564952904.3444469,“描述”:“完全爬网”}
22:08:28805:[io 0x7F87BA00818/Users/coolman/project/react native app]爬网完成
解决方案
在我的中添加“content\u hash\u max\u items”:500000
。watchmanconfig
为我解决了这个问题
说明:
听起来您需要调整工作负载的元数据缓存大小;当watchman试图插入比配置的缓存项更多的缓存项时,会发生此错误
您可以在.watchmanconfig
文件中指定更大的值:
与content\u hash\u max\u items
元数据相关,默认为content.sha1hex
。一个相关选项是131072
,它默认为content\u hash\u max\u warm\u per\u solution
,并导致在每次结算时评估多达这么多的项目1024
默认为symlink\u target\u max\u items
。在查询请求符号链接目标的情况下,此缓存用于32768
。这不太可能是你的问题readlink
find/Users/coolman/project/react native app | wc-l
,获得项目中当前文件数量的上限,并使用该上限来调整这些缓存的大小;如果您拥有的文件多于这些默认值,则应相应提高这些缓存设置
我不建议将fsevents\u latency
参数更改为默认值;你能分享更多关于是什么导致你改变它的背景吗
22:08:24,193: [client=0x7ff4a9686d98:stm=0x7ff4a9b2de00:pid=0] send_error_response: too many pending cache jobs
22:08:24,340: [listener] Watchman 4.9.0 <no build info set> starting up on coolman
22:08:24,341: [listener] path /Users/coolman/project/react-native-app is on filesystem type apfs
22:08:24,342: [listener] root /Users/coolman/project/react-native-app using watcher mechanism fsevents (auto was requested)
22:08:24,344: [listener] file limit is 2560 kern.maxfilesperproc=524288
22:08:24,344: [listener] raised file limit to 524288
22:08:24,345: [listener] launchd: "sock" wasn't present in Sockets
22:08:28,805: [io 0x7f87ba000818 /Users/coolman/project/react-native-app] PERF: {"ru_nvcsw": 1460, "ru_nsignals": 0, "ru_msgrcv": 0, "ru_msgsnd": 0, "ru_inblock": 0, "ru_majflt": 0, "ru_nswap": 0, "ru_minflt": 28103, "ru_ixrss": 0, "ru_maxrss": 115109888, "system_time": 2.9349970000000001, "user_time": 1.327971, "elapsed_time": 4.4614079999999996, "pid": 29414, "ru_idrss": 0, "meta": {"root": {"watcher": "fsevents", "ticks": 2, "number": 1, "case_sensitive": false, "recrawl_count": 0, "path": "/Users/coolman/project/react-native-app"}}, "version": "4.9.0", "ru_oublock": 0, "ru_nivcsw": 2171, "start_time": 1564952904.3444469, "description": "full-crawl"}
22:08:28,805: [io 0x7f87ba000818 /Users/coolman/project/react-native-app] crawl complete