Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error watchman took too long to load #239

Closed
Palgrover opened this issue Mar 26, 2015 · 50 comments
Closed

Error watchman took too long to load #239

Palgrover opened this issue Mar 26, 2015 · 50 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@Palgrover
Copy link

EDIT:

Please make sure you're running watchman 3.1. You can upgrade using the following:

watchman shutdown-server
brew update
brew upgrade watchman

Then run watchman version to make sure you're running v3.1


[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/WhackyApps/AwesomeProject/node_modules/react-native/packager/react-packager/src/FileWatcher/index.js:71:16) at Timer.listOnTimeout (timers.js:110:15)

@amasad amasad changed the title [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/WhackyApps/AwesomeProject/node_modules/react-native/packager/react-packager/src/FileWatcher/index.js:71:16) at Timer.listOnTimeout (timers.js:110:15) Watcher error Mar 26, 2015
@Palgrover Palgrover changed the title Watcher error Error watchman took too long to load Mar 26, 2015
@amasad
Copy link
Contributor

amasad commented Mar 26, 2015

Can you verify you installed watchman?

@Palgrover
Copy link
Author

Yes i did the brew install

@amasad
Copy link
Contributor

amasad commented Mar 26, 2015

Can you increase the wait time in here and try again? https://github.com/facebook/react-native/blob/master/packager/react-packager/src/FileWatcher/index.js#L31

You can find this file in your project_dir/node_modules/react-native/packager/react-packager/src/FileWatcher/index.js

@nuno
Copy link

nuno commented Mar 26, 2015

Same issue with me.

$ watchman
{
"error": "invalid command (expected an array with some elements!)",
"cli_validated": true,
"version": "3.0.0"
}

@amasad
Copy link
Contributor

amasad commented Mar 26, 2015

@nuno can you try bumping the wait time? and see if that works (see my previous comment)

@Palgrover
Copy link
Author

@amasad i increased the time so the thing that changed was this error came when project was starting in simulator but now it starts fine without error but after that when i change in my index.js and reload the simulator by cmd+R it gives the same error

@kangguru
Copy link

@amasad no not really, doubled it to 6000 and then 30000 but it still times out

@nuno
Copy link

nuno commented Mar 26, 2015

var MAX_WAIT_TIME = 30000;

===============================================================
 |  Running packager on port 8081.       
 |  Keep this packager running while developing on any JS         
 |  projects. Feel free to close this tab and run your own      
 |  packager instance if you prefer.                              
 |                                                              
 |     https://github.com/facebook/react-native                 
 |                                                              
 ===============================================================

Looking for JS files in
   /Users/nuno/Development/reactNative/AwesomeProject2

React packager ready.

[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/nuno/Development/reactNative/AwesomeProject2/node_modules/react-native/packager/react-packager/src/FileWatcher/index.js:71:16)
    at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)

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


[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/nuno/Development/reactNative/AwesomeProject2/node_modules/react-native/packager/react-packager/src/FileWatcher/index.js:71:16)
    at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)

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

@wez
Copy link

wez commented Mar 26, 2015

Would be great to see what's in your watchman logs.
https://facebook.github.io/watchman/docs/troubleshooting.html#where-are-the-logs
tells you where to find them; can you put them up in a gist?

@kangguru
Copy link

please see https://gist.github.com/kangguru/cdebd0615e883b324a03

but since i clear out the log file no new one was generated

@wez
Copy link

wez commented Mar 26, 2015

That log shows:

launchd checkin failed Operation not permitted

which is something I've not seen before. It also shows that no watches were ever established.

Can you attach the output of these commands:

uname -a
watchman watch-list
cat ~/Library/LaunchAgents/com.github.facebook.watchman.plist
/bin/ps -Awwx | grep watchman

@clauderic
Copy link

I had the same issue. Tried running watchman shutdown-server (to no avail). Restarting my computer fixed the problem for me.

@kangguru
Copy link

https://gist.github.com/kangguru/030fedcc477452debc3f

somewhere i saw an attempt to open /usr/local/Cellar/watchman/HEAD/var/run/watchman/ which was not created. but still after creating the directory its not working

i'll try the reboot then 👯

@wez
Copy link

wez commented Mar 26, 2015

Hmm, did you do a HEAD install?
/usr/local/Cellar/watchman/HEAD/var/run/watchman should be a directory that is writable to everyone, or at the very least, writable to you.

@kangguru
Copy link

had the same issue with 3.0.0, but now i switched back, ran watchman manually (with the flags from the plist) and it worked

then unloaded/loaded the plist and it keeps workign fingers crossed :)

@bumaociyuan
Copy link

sudo brew uninstall watchman
chown root:wheel /usr/local/bin/brew
sudo brew link pcre
sudo brew install watchman

@jaichandra
Copy link

restarting my computer fixed the problem.

@marynate
Copy link

Log out and re-log in fixed it for me.

@wez
Copy link

wez commented Mar 27, 2015

Can everyone that has had this issue comment here with the version of OS X that they are running?

@clauderic
Copy link

I'm running OS X Mavericks (10.9)

@marynate
Copy link

OS X 10.8.5, XCode 5.1.1, iOS SDK 8.2
(yes, I'm told it's time to upgrade, but still...)

@kangguru
Copy link

10.9.5

@tadeuzagallo
Copy link
Contributor

@wez I ran into that on 10.10.2 as well. same thing...
I tried everything, reinstalling, unloading and re-loading with launchctl, but just restarting fixed it. IIRC it was a fresh install, if that helps.

wez added a commit to facebook/watchman that referenced this issue Mar 27, 2015
Avoid this problem:

```
$ brew install -v --HEAD watchman
...
==> make install
/usr/bin/install -c -d -m 777 /usr/local/Cellar/watchman/HEAD/var/run/watchman
 ./install-sh -c -d '//usr/local/Cellar/watchman/HEAD/bin'
 ./install-sh -c -d '//usr/local/Cellar/watchman/HEAD/share/doc/watchman-3.0.0'
 /usr/bin/install -c -m 644 README.markdown '//usr/local/Cellar/watchman/HEAD/share/doc/watchman-3.0.0'
  /usr/bin/install -c watchman '//usr/local/Cellar/watchman/HEAD/bin'
==> Cleaning
rmdir: /usr/local/Cellar/watchman/HEAD/var/run/watchman (empty)
rmdir: /usr/local/Cellar/watchman/HEAD/var/run (empty)
rmdir: /usr/local/Cellar/watchman/HEAD/var (empty)
```

facebook/react-native#239 (comment)
@dbergey
Copy link

dbergey commented Mar 29, 2015

10.10.2. Rebooting fixed it. I didn't try the other things.

@JrSchild
Copy link

10.9.5, I'm not sure how, but I fixed it without re-logging in or restarting. I think I force quit Xcode, iOS Simulator, iTerm and the process com.apple.CoreSimulator.CoreSimulatorService (don't know if it's even related to the simulator, but it wasn't quitting automatically when stopping the simulator).

@wez
Copy link

wez commented Mar 29, 2015

If you've landed here and have this issue, please don't just reboot; while that will fix it for you, it won't help us get to the bottom of what isn't working. We'd like to fix it so that you don't need to reboot.

facebook/watchman#90 (comment) has the current set of steps that will help us figure this out.

Thanks!

@wez
Copy link

wez commented Apr 1, 2015

Yep, sounds good to me; thanks!

@foolyoghurt
Copy link

@jaichandra Thank you! Reboot just solved the problem!

@levi6717
Copy link

on 10.9.5
installed watchman
restart the system. The errors gone~

@wez
Copy link

wez commented Apr 10, 2015

@amasad Can we edit the description of this issue to tell folks to:

watchman shutdown-server
brew update
brew upgrade watchman

And then check the output of watchman version and make sure that they are running version 3.1 or later.

Watchman 3.1 is now available in homebrew, so the various docs around this can be changed back from suggesting a HEAD install.

While a reboot fixes the immediate problem, upgrading to watchman 3.1 is strongly recommended to resolve a couple of launchd related issues.

@pcottle
Copy link
Contributor

pcottle commented Apr 11, 2015

@wez Would it be appropriate to also list this from https://facebook.github.io/watchman/docs/troubleshooting.html? I know we link to the react native troubleshooting guide later in the error message, but it's easy to see this one first:

 ERROR  Watcher took too long to load
Try running `watchman` from your terminal
https://facebook.github.io/watchman/docs/troubleshooting.html

Not a huge deal, just worried people won't end up looking at both.

@wez
Copy link

wez commented Apr 12, 2015

@pcottle Yep, I'll add that to the troubleshooting guide. Can you fix up that "Try running watchman from your terminal" message so that it says "Try running watchman version from your terminal"?

Just running watchman on its own outputs an error because it expects arguments, and this has confused a couple of people.

@amasad
Copy link
Contributor

amasad commented Apr 13, 2015

@wez done, will also update the docs and the error message

@frantic
Copy link
Contributor

frantic commented Apr 19, 2015

This still sometimes happen on TravisCI, here is an example run https://travis-ci.org/facebook/react-native/jobs/59088796

==> Installing watchman
==> Downloading https://homebrew.bintray.com/bottles/watchman-3.1.mavericks.bott
....
 ERROR  Watcher took too long to load
Try running `watchman` from your terminal

Any way to debug that? We do brew update && brew reinstall watchman for every run to get the latest release, and from the discussions above sounds like 3.1 should be good enough.

@wez
Copy link

wez commented Apr 20, 2015

@frantic can you have your travis build bits cat (or at least tail a decent amount of) the watchman log?
It will be available as /usr/local/Cellar/watchman/3.1/var/run/watchman/$USER.log for watchman version 3.1 (the 3.1 comes from the brew version number).

@frantic
Copy link
Contributor

frantic commented Apr 21, 2015

I've added cat $WATCHMAN_LOG in #956, here is the output

https://travis-ci.org/facebook/react-native/jobs/59471656

1429657905: tid=50418448 Using watcher mechanism fsevents
1429657905: tid=50418448 file limit is 256 kern.maxfilesperproc=10240
1429657905: tid=50418448 raised file limit to 10240
1429657905: tid=50418448 Using socket from launchd as listening socket
1429657905: tid=50418448 failed to parse json from /usr/local/Cellar/watchman/3.1/var/run/watchman/travis.state: unable to open /usr/local/Cellar/watchman/3.1/var/run/watchman/travis.state: No such file or directory

@frantic
Copy link
Contributor

frantic commented Apr 22, 2015

More samples. This is the log when watchman starts and works fine with RN packager:

1429744175: tid=113029904 Using watcher mechanism fsevents
1429744175: tid=113029904 file limit is 256 kern.maxfilesperproc=10240
1429744175: tid=113029904 raised file limit to 10240
1429744175: tid=113029904 Using socket from launchd as listening socket
1429744175: tid=113029904 failed to parse json from /usr/local/Cellar/watchman/3.1/var/run/watchman/travis.state: unable to open /usr/local/Cellar/watchman/3.1/var/run/watchman/travis.state: No such file or directory
1429744175: tid=160116736 path /Users/travis/build/facebook/react-native is on filesystem type hfs

And here is another failure:

1429744229: tid=40600336 Using watcher mechanism fsevents
1429744229: tid=40600336 file limit is 256 kern.maxfilesperproc=10240
1429744229: tid=40600336 raised file limit to 10240
1429744229: tid=40600336 Using socket from launchd as listening socket
1429744229: tid=40600336 failed to parse json from /usr/local/Cellar/watchman/3.1/var/run/watchman/travis.state: unable to open /usr/local/Cellar/watchman/3.1/var/run/watchman/travis.state: No such file or directory

The last record ("...path /Users/travis/build/facebook/react-native...") is missing. Any ideas?

@frantic frantic reopened this Apr 22, 2015
sahrens pushed a commit to sahrens/react-native that referenced this issue Apr 22, 2015
Summary:
@wez Mentioned this in Issue facebook#239 -- right now when watchman takes too long we recommend you run `watchman` from your terminal which actually expects some arguments, so it prints out the following:

```
[pcottle:~/Desktop/react-native:changeErrorMessage]$ watchman
{
    "error": "invalid command (expected an array with some elements!)",
    "cli_validated": true,
    "version": "3.0.0"
}
```

basically this ends up being more confusing since the command we recommend you run errors out, so lets change it to `watchman version` which at least exists cleanly.

I kept the troubleshooting link as https://facebook.github.io/watchman/docs/troubleshooting.html since it sounds like we will update that with the issue people run into in facebook#239
Closes facebook#825
Github Author: Peter Cottle <pcottle@fb.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
@wez
Copy link

wez commented Apr 22, 2015

if the path XXX is on filesystem bit is not in the log, it implies that no watches were ever established. Are you sure that there isn't something else getting in the way of this?
How long is too long? Is it long enough that it will have a reasonable amount of time to run in a CI environment?

@frantic
Copy link
Contributor

frantic commented Apr 25, 2015

Bumped the timeout to 25 seconds, seeing this in logs

1429928793: tid=138003216 Using watcher mechanism fsevents
1429928793: tid=138003216 file limit is 256 kern.maxfilesperproc=10240
1429928793: tid=138003216 raised file limit to 10240
1429928793: tid=138003216 Using socket from launchd as listening socket
1429928793: tid=138003216 failed to parse json from /usr/local/Cellar/watchman/3.1/var/run/watchman/travis.state: unable to open /usr/local/Cellar/watchman/3.1/var/run/watchman/travis.state: No such file or directory
1429928793: tid=185184256 path /private/tmp/react-native-oIVHCTbQ/EndToEndTest is on filesystem type hfs

Still, packager reports "Watcher took too long to load", see build logs

@wez
Copy link

wez commented Apr 26, 2015

I found out about this fsevents bug today:
http://feedback.livereload.com/knowledgebase/articles/86239-os-x-fsevents-bug-may-prevent-monitoring-of-certai
wonder if this might be a factor?

@wez
Copy link

wez commented Apr 26, 2015

The watchman issue I just cross linked is a perf bug that should only hit very long running instances. I wouldn't expect it to apply in the Travis environment, but in any case, I'd recommend that you bookend your test run with pkill -9 watchman to kill any pre-existing watchman that might be running at the start of the run, and make sure that it isn't left running at the end.

@frantic
Copy link
Contributor

frantic commented Apr 29, 2015

Yeah, tried pkilling - no watchman is running. If you have some time we can try reverse-shell-inspecting a running Travis container?

@frantic
Copy link
Contributor

frantic commented May 4, 2015

Disabled watchman on Travis for now #1140

@frantic frantic closed this as completed May 4, 2015
@austinkelleher
Copy link

I was on Node.js 0.10. Switching to 0.12 fixed the issue.

@BrendanFDMoore
Copy link

@amasad Does an analogous setting still exist for MAX_WAIT_TIME?
I am currently experiencing this problem under Ubuntu 16.04, but have been unable to find any wait time setting to extend. The FileWatcher appears to not be in use any longer, so your posted link above lands at a 404 error.

Thanks!

@BrendanFDMoore
Copy link

BrendanFDMoore commented Jul 27, 2016

Ok, I managed to figure this out.
In this commit we see the file getting moved from packager/react-packager/src/FileWatcher/index.js to packager/react-packager/src/DependencyResolver/FileWatcher/index.js

Then in this commit the FileWatcher is completely re-structured under node-haste.

To change MAX_WAIT_TIME now, you should be accessing react-native/node_modules/node-haste/src/FileWatcher/index.js: https://github.com/facebook/node-haste/blob/master/src/FileWatcher/index.js
(The project I am trying to run has it built as node-haste/lib/FileWatcher/)

@charlesfranciscodev
Copy link

charlesfranciscodev commented Apr 1, 2017

I get Watchman error: Watcher took too long to load and I don't know how to fix it permanently.
For now I have to reinstall watchman to fix it.
Ubuntu 16.04.2 LTS
watchman version 4.7.0
MAX_WAIT_TIME = 120000
Installation

Error: Watchman error: Watcher took too long to load (WatchmanWatcher)
Try running watchman version from your terminal
https://facebook.github.io/watchman/docs/troubleshooting.html. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.html.
at Promise.all.then.then.error (Project/node_modules/react-native/packager/react-packager/src/node-haste/crawlers/watchman.js:64:15)

@facebook facebook locked as resolved and limited conversation to collaborators May 29, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests