Search code examples
facebookreactjsreact-nativenativewatchman

React Native `npm start` with watchman error


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


Solution

  • 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