React Native `npm start` with watchman error
Asked Answered
D

3

8

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.

output after <code>npm start</code>

Update: So I tried running react-native run-ios which opens a new console window and invokes npm 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: screenshot of console

Dispossess answered 4/11, 2016 at 1:58 Comment(1)
Did you run through the watchman troubleshooting guide? First place to start is looking at the logs: facebook.github.io/watchman/docs/…Szechwan
D
15

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
Dispossess answered 5/11, 2016 at 18:0 Comment(3)
I had the same problem while packaging an Exponent app. It looks like it's a known issue with older versions of watchman (facebook.github.io/watchman/docs/troubleshooting.html, scroll all the way to the bottom). A simple "brew reinstall watchman" did it for me.Junket
brew install rmtree didn't work for me but brew tap beeftornado/rmtree did the job insteadAgha
make doesn't work for me. I'm getting an error: root/stat.c:188:13: error: logical not is only applied to the left hand side of this bitwise operator [-Werror,-Wlogical-not-parentheses].Monocle
S
7

run this command inside project folder

watchman watch-del-all && npm start --reset-cache
Salisbury answered 4/11, 2016 at 6:10 Comment(1)
no luck :( still getting the same Warning: Lost Connection to watchman, reconnecting...Dispossess
D
1

I have a simular issue and looking at the logs for Watchman I get these errors happening each time you see the "Lost Connection to Watchman" message.

2016-11-05T03:35:48,401: [listener] Watchman 4.7.0 <no build info set> starting up on Davids-Mac.local

2016-11-05T03:35:48,401: [listener] path /Users/david/Projects/react-native-test is on filesystem type hfs

2016-11-05T03:35:48,402: [listener] root /Users/david/Projects/react-native-test using watcher mechanism fsevents (auto was requested)

2016-11-05T03:35:48,406: [listener] file limit is 2560 kern.maxfilesperproc=10240

2016-11-05T03:35:48,406: [listener] raised file limit to 10240

2016-11-05T03:35:48,407: [listener] Using socket from launchd as listening socket

2016-11-05T03:35:48,934: [io 0x7f8175600ff8 /Users/david/Projects/react-native-test] PERF: {"ru_nvcsw": 0, "ru_nsignals": 0, "ru_msgrcv": 6, "ru_msgsnd": 6, "ru_inblock": 0, "ru_majflt": 0, "ru_nswap": 0, "ru_minflt": 5230, "ru_ixrss": 0, "ru_maxrss": 21405696, "system_time": 0.32367200000000002, "user_time": 0.18271599999999999, "elapsed_time": 0.53129999999999999, "pid": 9867, "ru_idrss": 0, "meta": {"root": {"watcher": "fsevents", "ticks": 2, "number": 1, "case_sensitive": false, "recrawl_count": 0, "path": "/Users/david/Projects/react-native-test"}}, "version": "4.7.0", "ru_oublock": 0, "ru_nivcsw": 112, "start_time": 1478316948.403332, "description": "full-crawl"}

2016-11-05T03:35:48,935: [io 0x7f8175600ff8 /Users/david/Projects/react-native-test] crawl complete

2016-11-05T03:35:49,029: [client=0x7f8176a00038:stm=0x7f8176a00000] Unilateral payload for sub sane-sub {"settled": true}

Terminating due to signal 11 Segmentation fault generated by pid=0 uid=0. address not mapped to object (0x0)
0   watchman                            0x0000000105973759 _ZL13crash_handleriP9__siginfoPv + 347
1   libsystem_platform.dylib            0x00007fffa2292bba _sigtramp + 26
2   ???                                 0x00007f81756000c0 0x0 + 140193996734656
3   watchman                            0x000000010596f9b2 _ZN6detail22estimateSpaceToReserveIPKcJA3_cA28_c8w_stringA2_cPcS6_EEEmmRKT_DpRKT0_ + 109
4   watchman                            0x000000010596f815 _ZN8w_string5buildIJPcRA4_KcPS2_RA3_S2_RA28_S2_RS_RA2_S2_RS1_SC_EEES_DpOT_ + 121
5   watchman                            0x000000010599b4cb _ZN8watchman3Log3logIJRA28_KcR8w_stringRA2_S2_RPcS8_EEEvNS_8LogLevelEDpOT_ + 183
6   watchman                            0x000000010599a6e0 _ZNSt3__114__thread_proxyINS_5tupleIJZL15make_new_clientP15watchman_streamE3$_0EEEEEPvS6_ + 952
7   libsystem_pthread.dylib             0x00007fffa229cabb _pthread_body + 180
8   libsystem_pthread.dylib             0x00007fffa229ca07 _pthread_body + 0
9   libsystem_pthread.dylib             0x00007fffa229c231 thread_start + 13

UPDATE: Ok, found a solution which so far seems to work. I uninstall watchman completely, then build it from source using the following which seems to work fine (any attempt at installing via brew causes the problems above but this works):

$ 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
Deterioration answered 5/11, 2016 at 2:48 Comment(2)
Just wanted to add that I was able to resolve this problem by doing the following:Deterioration
okay I got it working BUT before running sudo make install I had to do sudo rm -rf /usr/local/var/run/watchman. AND after sudo make install I had to do chmod 0700 /usr/local/var/run/watchman/<user>-stateDispossess

© 2022 - 2024 — McMap. All rights reserved.