react-native - 加载依赖关系图...jest-haste-map: Watchman crawl failed
问题描述
我不能只用“react-native init AwesomeProject”和“react-native run-ios”创建一个空项目。我收到以下错误。当我将 EXPO 与 Bare Workflow 一起使用时,也会发生这种情况。
守望者-v:4.9.0
我的 package.json 说:“react-native”:“0.59.9”
有什么帮助吗?我在网上看到了许多类似的问题,但没有一个建议的解决方案对我有用。
Loading dependency graph...jest-haste-map: Watchman crawl failed. Retrying once with node crawler.
Usually this happens when watchman isn't running. Create an empty `.watchmanconfig` file in your project's root folder or initialize a git or hg repository in your project.
Error: Watchman error: The watchman connection was closed. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.html.
events.js:167
throw er; // Unhandled 'error' event
^
Error: The watchman connection was closed
at Client.cancelCommands ({mypath}/node_modules/fb-watchman/index.js:52:15)
at Socket.<anonymous> ({mypath}/node_modules/fb-watchman/index.js:128:12)
at Socket.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1092:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at handleError ({mypath}/node_modules/metro/node_modules/jest-haste-map/build/lib/WatchmanWatcher.js:362:10)
at Object.onWatchProject [as cb] ({mypath}/node_modules/metro/node_modules/jest-haste-map/build/lib/WatchmanWatcher.js:135:9)
at {mypath}/node_modules/fb-watchman/index.js:66:9
at Array.forEach (<anonymous>)
at Client.cancelCommands ({mypath}/node_modules/fb-watchman/index.js:65:8)
at Socket.<anonymous> ({mypath}/node_modules/fb-watchman/index.js:128:12)
[... lines matching original stack trace ...]
at process._tickCallback (internal/process/next_tick.js:63:19)
Process terminated. Press <enter> to close the window
解决方案
回答我自己的问题。罪魁祸首原来是.watchmanconfig
文件。该文件的内容如下:
{"fsevents_latency": "0.01"}
我已将值从 string 更改为 int,现在一切都对我有用:
{"fsevents_latency": 0.01}