Watchman: Unable to stop watching a directory

Created on 21 Apr 2017  路  4Comments  路  Source: facebook/watchman

Forgive me if this is due to a poor understanding.

I'm using ReactNative and get an error whereby watchman errors on a directory I do not use watchman with: Unable to talk to your watchman on /usr/local/var/run/watchman/my-project-readonly-state/sock!

I followed this error with using watchman watch-list

this reveals:

"roots": [
        "/Users/mikejames/projects/work/my-project",
        "/Users/mikejames/projects/work/app-platform",
        "/Users/mikejames/projects/graphql-journey",
        "/Users/mikejames/projects/mynative-react"
    ]

mynative-react being the only root I use react native and implicitly watchman with.

I've ran watchman watch-del-all this didn't remove my-project and neither did watchman watch-del /Users/mikejames/projects/work/my-project

I tried to uninstalling and reinstalling via brew. removing the watchman folder in /usr/local/var/run and nothing :(

contents of: /usr/local/var/run/watchman

drwxrwxrwx  4 mikejames  admin   136B 18 Apr 22:16 .
drwxr-xr-x  3 mikejames  admin   102B 18 Apr 22:15 ..
drwx--S---  6 mikejames  admin   204B 21 Apr 19:33 my-project-readonly-state
drwx--S---  6 mikejames  admin   204B 21 Apr 19:33 mikejames-state

Any help pointers in what todo will be really helpful!

OSX: 10.12.3
watchman: 4.7.0
node: v6.10.0

Most helpful comment

Watchman clients look at the $USER environment variable to figure out who you are and to determine the location of the unix domain socket that it should be using to communicate to your watchman server.

It sounds like something on your system is setting USER to something that is not your username. If you can figure out what that is and resolve it, things should become better.

All 4 comments

What do you mean by didn't remove?

If you run:

watchman watch-del-all
watchman watch-list

the watch list should be empty. If that is true, and then things show up in the watch list later, it means that something you are doing is triggering something to watch those dirs.

This is most likely because something in react native is establishing those watches for you.

Is my-project-readonly a user on your system? Are you running as two different users?

@wez your right running watch-del-all removes my-project from the list.

I don't have this user on my mac:

$ dscl . list /Users | grep -v '^_'
daemon
Guest
mikejames
nobody
root

After running watch-del-all I'm finding that when I go back to running a build via xcode which triggers watchman its giving me the same error: Unable to talk to your watchman on /usr/local/var/run/watchman/my-project-readonly-state/sock!

this also occurs when I run a clean react native project

Watchman clients look at the $USER environment variable to figure out who you are and to determine the location of the unix domain socket that it should be using to communicate to your watchman server.

It sounds like something on your system is setting USER to something that is not your username. If you can figure out what that is and resolve it, things should become better.

@wez complete blunder myside USER=my-project-readonly was set :face-palm:

Thanks for your help

Was this page helpful?
0 / 5 - 0 ratings