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

watchman took too long to load with ReactNative #90

Closed
nicopasso opened this issue Mar 29, 2015 · 27 comments
Closed

watchman took too long to load with ReactNative #90

nicopasso opened this issue Mar 29, 2015 · 27 comments

Comments

@nicopasso
Copy link

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?

@wez
Copy link
Contributor

wez commented Mar 29, 2015

Can you try:

brew uninstall watchman
brew install --HEAD watchman

and see if that helps?

@nicopasso
Copy link
Author

I've got the same error.

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

@wez
Copy link
Contributor

wez commented Mar 29, 2015

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

@wez
Copy link
Contributor

wez commented Mar 29, 2015

Can you clarify what you mean by restart all?

@wez wez changed the title Watchman - ReactNative watchman took too long to load with ReactNative Mar 29, 2015
@rywhee
Copy link

rywhee commented Mar 29, 2015

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 

@kellyjandrews
Copy link

@wez
Copy link
Contributor

wez commented Mar 29, 2015

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

@wez
Copy link
Contributor

wez commented Mar 29, 2015

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

@kellyjandrews
Copy link

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

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

@kellyjandrews
Copy link

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

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

@wez
Copy link
Contributor

wez commented Mar 29, 2015

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

watchman watch .
watchman watch-list

@rywhee
Copy link

rywhee commented Mar 29, 2015

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

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

@wez
Copy link
Contributor

wez commented Mar 29, 2015

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

@kellyjandrews
Copy link

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 :)

@rywhee
Copy link

rywhee commented Mar 29, 2015

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

Any idea what that would vary?

@wez
Copy link
Contributor

wez commented Mar 29, 2015

@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

wez added a commit that referenced this issue Mar 29, 2015
Don't rely on the user have the same umask as me, force the permissions
to be correct.

I'm guessing that the ownership is something that gets fixed on reboot,
which would explain why things start working for folks that reboot.

Refs #90
@wez
Copy link
Contributor

wez commented Mar 29, 2015

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

@rywhee
Copy link

rywhee commented Mar 29, 2015

@wez happy to - appreciate the assistance!

@kellyjandrews
Copy link

@wez Anytime

@MarcL
Copy link

MarcL commented Mar 30, 2015

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

@wez
Copy link
Contributor

wez commented Mar 30, 2015

@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?

@emekanw
Copy link

emekanw commented Mar 30, 2015

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.

@wez
Copy link
Contributor

wez commented Mar 31, 2015

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

brew uninstall watchman
brew install --HEAD watchman

to pick up that change.

@emekanw
Copy link

emekanw commented Mar 31, 2015

Cool. Thanks

@MarcL
Copy link

MarcL commented Mar 31, 2015

@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

tehfailsafe added a commit to tehfailsafe/react-native that referenced this issue Apr 1, 2015
Added quick reinstall --HEAD fix for watchman
facebook/watchman#90
@wez
Copy link
Contributor

wez commented Apr 1, 2015

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!

@Dcl1
Copy link

Dcl1 commented Jul 13, 2016

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants