我不能仅使用“ react-native init AwesomeProject”和“ react-native run-ios”创建一个空项目。我收到以下错误。当我在裸机工作流中使用EXPO时也会发生这种情况。
watchman -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
答案 0 :(得分:0)
这似乎是与watchman
相关的错误。如果您没有安装Watchman
,
通过brew安装。
$ brew install rmtree
$ brew rmtree watchman
$ sudo rm -rf /usr/local/var/run/watchman
如果已安装,请在完全删除它之后尝试手动安装。
$ git clone https://github.com/facebook/watchman.git
$ cd watchman
$ git checkout v4.7.0 # the latest stable release
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
$ chmod 0700 /usr/local/var/run/watchman/<user>-state
答案 1 :(得分:0)
回答我自己的问题。罪魁祸首是.watchmanconfig
文件。该文件的内容如下:
{"fsevents_latency": "0.01"}
我已将值从string更改为int,现在一切对我有用:
{"fsevents_latency": 0.01}