反应本机`npm start`带守望者错误 [英] React Native `npm start` with watchman error
问题描述
我第一次遇到此问题:
更新:所以我尝试运行 react-native run-ios
,它打开一个新的控制台窗口并调用 npm start
。它仍然给出 [sane]警告:丢失连接到守望者,重新连接..
警告,但它构建捆绑。所以守望者之间的关系越来越多。这是控制台屏幕截图:
我解决了这个问题通过遵循David提供的解决方案,但我不得不采取一些额外的步骤,因为我已经使用brew安装了看门人。以下是解决方案的命令列表:
删除守望者(由brew安装):
$ brew install rmtree
/ pre>
$ brew rmtree watchman
$ sudo rm -rf / usr / local / var / run / watchman
手动安装Watchman v4.7.0(赠送给David):
$ git clone https://github.com/facebook/watchman.git
$ cd watchman
$ git checkout v4.7.0
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
Chmod您的用户看门人状态目录:
$ chmod 0700 / usr / local / var / run / watchman /< user> -state
I was first getting this issue: https://github.com/facebook/react-native/issues/10088
Then I followed this solution to resolve for that issue: https://github.com/facebook/react-native/issues/910#issuecomment-94181845
Now when I enter
npm start
I get[sane] Warning: Lost connection to watchman, reconnecting..
. Any suggestions?Update: This started happening when I updated my MacOS to MacOS Sierra.
Update: So I tried running
react-native run-ios
which opens a new console window and invokesnpm start
. Its still gives the[sane] Warning: Lost connection to watchman, reconnecting..
warnings but its builds the bundle. So watchman connection is getting broken in between. Here is the console screenshot:解决方案I solved this problem by following the solution provided by David but I had to do some extra steps because I already had installed watchman using brew. Here are the list of commands for the solution:
Deleting watchman (installed by brew):
$ brew install rmtree $ brew rmtree watchman $ sudo rm -rf /usr/local/var/run/watchman
Manually install Watchman v4.7.0 (credits to David):
$ git clone https://github.com/facebook/watchman.git $ cd watchman $ git checkout v4.7.0 $ ./autogen.sh $ ./configure $ make $ sudo make install
Chmod your user's watchman state directory:
$ chmod 0700 /usr/local/var/run/watchman/<user>-state
这篇关于反应本机`npm start`带守望者错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!