watchman took too long to load with ReactNative

Created on 29 Mar 2015  Â·  27Comments  Â·  Source: facebook/watchman

Hi,

I'm facing this error when I run 'npm start' on react-native folder.

[Error: Watcher took too long to load
Try running watchman from your terminal
https://facebook.github.io/watchman/docs/troubleshooting.html]
Error: Watcher took too long to load
Try running watchman from your terminal
https://facebook.github.io/watchman/docs/troubleshooting.html
at null._onTimeout (/Users/niccolo/Desktop/iOS Projects/react-native/packager/react-packager/src/FileWatcher/index.js:71:16)
at Timer.listOnTimeout (timers.js:110:15)

ERROR: could not create packager - please shut down any existing instances that are already running.

I've just installed watchman via homebrew.
How can I fix this error?

Most helpful comment

Can you try:

brew uninstall watchman
brew install --HEAD watchman

and see if that helps?

All 27 comments

Can you try:

brew uninstall watchman
brew install --HEAD watchman

and see if that helps?

I've got the same error.

EDIT: it works...I had to restart all. Thanks!

If you're arriving here with this issue, please don't just reboot. Help us figure out the root cause by working through the following steps:

  1. Get a HEAD install of watchman. This will fix some known launchd issues:
brew uninstall watchman
brew install --HEAD watchman
  1. Re-try with ReactNative
  2. Collect your watchman logs and put them in a gist.
    You can find them in /usr/local/Cellar/watchman/HEAD/var/run/watchman/$USER.log
  3. open /Applications/Utilities/Console.app and filter by launchd and/or watchman and report
    anything that might be relevant
  4. include the output from these commands:
watchman watch-list
ls -al ~/Library/LaunchAgents
launchctl list com.github.facebook.watchman

Can you clarify what you mean by restart all?

Hi @wez....

Been having this issue on my main account on multiple computers. However, the issue does _not_ come up when creating a new user account. Have done a HEAD install of watchman but to no avail.

  • No log files exist here:
/usr/local/Cellar/watchman/HEAD/var/run/watchman
  • Console app reports:
Caller specified a plist with bad ownership/permissions: path = /Users/ryanwheeler/Library/LaunchAgents/com.github.facebook.watchman.plist, caller = launchctl.5684
  • LaunchAgents:
$ ls -al ~/Library/LaunchAgents
total 40
drwx------   7 ryanwheeler  staff   238 Mar 29 16:55 .
drwx------+ 61 ryanwheeler  staff  2074 Mar 21 11:04 ..
-r--r--r--   1 ryanwheeler  staff   482 Nov  5 15:16 com.citrixonline.GoToMeeting.G2MUpdate.plist
-rw-rw-rw-   1 ryanwheeler  staff  1097 Mar 29 17:09 com.github.facebook.watchman.plist
-rw-r--r--@  1 ryanwheeler  staff   538 Mar 29 16:55 com.spotify.webhelper.plist
-rw-r--r--@  1 ryanwheeler  staff   618 Jul 17  2014 net.tunnelblick.tunnelblick.LaunchAtLogin.plist
-rw-r--r--   1 ryanwheeler  staff   677 Mar 21 11:06 org.virtualbox.vboxwebsrv.plist
  • launchctl list com.github.facebook.watchman:
Could not find service "com.github.facebook.watchman" in domain for 

@rywhee ah, interesting. Can you chmod 644 ~/Library/LaunchAgents/com.github.facebook.watchman.plist and then run watchman watch-list?

@kellyjandrews what happens if you run watchman watch-list?

{
    "version": "3.0.0",
    "roots": []
}

In all fairness - I could have no idea what I'm doing. :)

Ok - I went to the folder I'm trying to use this in -

$ watchman watch ./
{
    "version": "3.0.0",
    "watch": "/Users/kellyjandrews/Apps/AwesomeProject"
}

@kellyjandrews that actually looks like watchman is working to me. Does the react-native stuff work? Can you do:

watchman watch .
watchman watch-list

@wez - watchman watch-list after chmod on the plist:

{
    "version": "3.0.0",
    "roots": []
}

@rywhee sounds like watchman is now working for you; does the react native stuff work now?

Totally workin - I had to restart my React packager.

FWIW - I had a ton of clean up work to brew that I needed to do. Running brew doctor and cleaning that list up was a bit of work, but helpful in the long run. My xcode was out of date, as well my cli tools.

Not sure which step I did that ended up resolving it, but the out of date-ness may have played a factor.

Thanks for the guidance - now I can go play :)

@wez - Indeed.... live reload working as expected after the permissions change. Thank you!

Any idea what that would vary?

@rywhee I'm guessing that your umask is set differently, causing the plist file to get created with bad permissions. I'll push a diff that forces the permissions to be correct shortly

@kellyjandrews, @rywhee thanks for working through this with me!

@wez happy to - appreciate the assistance!

@wez Anytime

Hi @wez,

I'm getting the same error on OSX 10.9.5.
I had previous installed Node via the package on their website but I've now uninstalled it and reinstalled using brew.

I've tried installing the HEAD version as described above but I'm getting the following when just running watchman:

{
    "error": "invalid command (expected an array with some elements!)",
    "cli_validated": true,
    "version": "3.0.0"
}
  • Here's the log file from /usr/local/Cellar/watchman/HEAD/var/run/watchman/marc.log:
1427748328: tid=2017653520 Using watcher mechanism fsevents
1427748328: tid=2017653520 file limit is 256 kern.maxfilesperproc=10240
1427748328: tid=2017653520 raised file limit to 10240
1427748328: tid=2017653520 Using socket from launchd as listening socket
1427748328: tid=2017653520 failed to parse json from /usr/local/Cellar/watchman/HEAD/var/run/watchman/marc.state: unable to open /usr/local/Cellar/watchman/HEAD/var/run/watchman/marc.state: No such file or directory
  • Console.app is giving me:
30/03/2015 21:44:48.457 com.apple.launchd.peruser.501[177]: (com.github.facebook.watchman[9566]) Job failed to exec(3). Setting up event to tell us when to try again: 2: No such file or directory
30/03/2015 21:44:48.457 com.apple.launchd.peruser.501[177]: (com.github.facebook.watchman[9566]) Job failed to exec(3) for weird reason: 2
30/03/2015 21:45:28.855 com.apple.launchd.peruser.501[177]: (com.github.facebook.watchman) Job should be able to exec(3) now.
  • Launch agents:
➜  ReactNativeTest  ls -al ~/Library/LaunchAgents
total 40
drwxr-xr-x   7 marc  staff   238 30 Mar 21:04 .
drwx------@ 57 marc  staff  1938 12 Mar 20:46 ..
-rw-r--r--   1 marc  staff   521 30 Mar 21:04 com.backblaze.bzbmenu.plist
-rw-r--r--   1 marc  staff  1069 30 Mar 21:42 com.github.facebook.watchman.plist
-rw-r--r--@  1 marc  staff   801  7 Mar 12:03 com.google.keystone.agent.plist
-rw-r--r--@  1 marc  staff   531 30 Mar 21:03 com.spotify.webhelper.plist
-rw-r--r--   1 marc  staff   810 30 Mar 21:04 com.valvesoftware.steamclean.plist
  • Launchctl:
➜  ReactNativeTest  launchctl list com.github.facebook.watchman
{
    "Label" = "com.github.facebook.watchman";
    "LimitLoadToSessionType" = "Aqua";
    "OnDemand" = true;
    "LastExitStatus" = 512;
    "PID" = 11947;
    "TimeOut" = 30;
    "ProgramArguments" = (
        "/usr/local/bin/watchman";
        "--foreground";
        "--logfile=/usr/local/Cellar/watchman/HEAD/var/run/watchman/marc.log";
        "--sockname=/usr/local/Cellar/watchman/HEAD/var/run/watchman/marc";
        "--statefile=/usr/local/Cellar/watchman/HEAD/var/run/watchman/marc.state";
    );
    "Sockets" = {
        "sock" = (
            file-descriptor-object;
        );
    };
};

I've tried watchman watch-list but it appears to hang without doing anything. If I CTRL+C it then it doesn't allow me to run watchman again as the permissions appear to have changed:

➜  ReactNativeTest  watchman
zsh: permission denied: watchman

Any ideas?

Cheers,
Marc

@MarcL what does ls -l /usr/local/bin/watchman /usr/local/Cellar/watchman/HEAD/bin/watchman output?

Did you uninstall watchman between some of these attempts?

What does /bin/ps -ef | grep watchman output?

What does which watchman output from your terminal window?

Had the same issue, was able to resolve it by:

removing any pre-existing install of watchman in brew

brew uninstall watchman

launchctl unload com.github.facebook.watchman.plist

rm com.github.facebook.watchman.plist

brew install --HEAD watchman

ran watchman watch-list it froze then I closed it and for some reason

/usr/local/Cellar/watchman/HEAD/bin/watchman

became non executable and I kept getting permissions issue the next time I ran watchman

so I tried
sudo chmod +x /usr/local/Cellar/watchman/HEAD/bin/watchman

and my issue became fixed.

Sorry, 81507da59377e0320d668cab7cdc369aaeced8c2 fixes this weird permission problem (doh!)
You should:

brew uninstall watchman
brew install --HEAD watchman

to pick up that change.

Cool. Thanks

@wez - This is an FYI in case you need it but it looks like watchman is now working.

This is after getting the permissions error and not re-installing watchman:

➜  ReactNativeTest  ls -l /usr/local/bin/watchman 
lrwxr-xr-x  1 marc  admin  36 30 Mar 21:45 /usr/local/bin/watchman -> ../Cellar/watchman/HEAD/bin/watchman
➜  ReactNativeTest  ls -l /usr/local/Cellar/watchman/HEAD/bin/watchman
-rw-r--r--  1 marc  admin  167408 30 Mar 21:45 /usr/local/Cellar/watchman/HEAD/bin/watchman


➜  ReactNativeTest  /bin/ps -ef | grep watchman
  501 12108  4103   0  8:32am ttys000    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=.cvs --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn watchman

➜  ReactNativeTest  which watchman
watchman not found

I've tried reinstalling watchman again (as per your recent commit above) and also removing the plist files as described by @emekanw but I still get the same "invalid command" issue when just running watchman.

However, watchman watch-list and watchman watch . now give me:

➜  ReactNativeTest  watchman watch .
{
    "version": "3.0.0",
    "watch": "/Users/marc/Documents/XCode/ReactNativeTest"
}
➜  ReactNativeTest  watchman watch-list
{
    "version": "3.0.0",
    "roots": []
}

npm run start runs the start script with no watchman issues and running the React Native project in XCode does the live reloading! It now seems to be working so thanks so much for your help.

I'm looking forward to playing with React Native and contributing some components back to the community.

Cheers,
Marc

I think we have this covered now in the react-native docs. We'll soon cut watchman 3.1 and update brew to pick that up, so I'm going to close this issue now.
Thanks!

@wez thank you! I know this is an old issue but for some reason I had to deal with this issue last night. Glad to get back to work!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fuechter picture fuechter  Â·  3Comments

cpojer picture cpojer  Â·  7Comments

the-simian picture the-simian  Â·  5Comments

williamcotton picture williamcotton  Â·  6Comments

seenickcode picture seenickcode  Â·  5Comments