Since yesterday, I have been getting this error every time I try to run my react-native project. I tried starting a brand new one from scratch, I ran into the same problem.
....
Loading dependency graph.
React packager ready.
Watchman: watchman --no-pretty get-sockname returned with exit code=null, signal=SIGKILL, stderr=
***ERROR STARTING PACKAGER***
jest-haste-map: Watchman crawl failed. Retrying once with node crawler.
Usually this happens when watchman isn't running. Create an empty `.watchmanconfig` file in your project's root folder or initialize a git or hg repository in your project.
Error: watchman --no-pretty get-sockname returned with exit code=null, signal=SIGKILL, stderr=
***ERROR STARTING PACKAGER***
Watchman: watchman --no-pretty get-sockname returned with exit code=null, signal=SIGKILL, stderr=
***ERROR STARTING PACKAGER***
Error: watchman --no-pretty get-sockname returned with exit code=null, signal=SIGKILL, stderr=
at ChildProcess.<anonymous> (/Users/sbish5/workspace/playground/res/node_modules/jest-haste-map/node_modules/sane/node_modules/fb-watchman/index.js:198:18)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
I have tried uninstalling and re-installing watchman using both brew and npm.
I have also tried creating an empty watchman config file and initializing a git repo.
If I re-start my computer, it works for a couple of times, then it starts failing again.
Can you check and share the watchman logs?
https://facebook.github.io/watchman/docs/troubleshooting.html
has information on figuring out where they are.
+1. I'm using watchman with the graphql-for-vscode plugin. It sometimes throws this error and doesn't start. The only way to get the plugin working is to kill watchman via watchman shutdown-server, and then reloading the plugin/vscode (which implicitly invokes watchman).
@wez I followed the troubleshooting guide, but I can't find any info on what the STATEDIR would be on a Windows machine.
Edit: I found the location of statedir on Windows: https://github.com/facebook/watchman/issues/460#issuecomment-300295834
The last few entries in the log are:
2017-05-18T13:51:20,010: [client=000001C395DB9810:stm=000001C393DAEE00] PERF: {"start_time": 1495095675.2349999, "pid": 13224, "description": "dispatch_command:subscribe", "meta": {"root": {"case_sensitive": false, "ticks": 17555, "path": "C:\\Workspace\\my-project", "recrawl_count": 0, "number": 1, "watcher": "win32"}, "args": ["subscribe", "C:\\Workspace\\my-project", "gqlSchemaFiles", {"expression": ["match", "schemas/**/*.gql", "wholename"], "fields": ["name", "exists", "type"]}]}, "version": "4.7.0", "elapsed_time": 4.7409999999999997}
2017-05-18T13:51:33,842: [io C:\Workspace\my-project] Failed to canon(C:\Workspace\my-project\ui\build\files): Access is denied.
2017-05-18T13:51:34,895: [io C:\Workspace\my-project] Failed to canon(C:\Workspace\my-project\ui\build\js): Access is denied.
Notably, the my-project/build/files and my-project/build/js folders are actually generated by a webpack build process, so they might be removed/added as I develop. At that time, I think maybe a race condition happens between watchman trying to read the folder, and windows trying to delete it?
@kumarharsh I think you have a different issue than @stephy; you're more likely to be experiencing something that is windows specific. Unfortunately, because of the way that this error is being surfaced, they both look the same. It's hard to say without seeing @stephy's logs.
I'm currently doing some work on the windows port around name canonicalization, so there's a decent chance that I'll be fixing @kumarharsh's issue.
@wez I can't find any logs. The documentation is unclear to me how to find STATEDIR.
This probably doesn't help at all, but I have tried:
10103 watchman version
10104 watchman watch-del-all && watchman shutdown-server
10105 ps aux | grep watchman
10106 sudo kill 6202
10107 ps aux | grep watchman
10108 watchman watch-del-all && watchman shutdown-serer
10109 watchman shutdown-server
10110 ps aux | grep watchman
10111 rm -rf $TMPDIR/haste-map-react-native-packager-c86fba0888adef0c67434b3d1a5b1953
10112 brew search watchman
10113 brew uninstall watchman
10114 watchman -h
10115 brew uninstall xde
10116 brew uninstall expo-xde
10117 which xde
10118 brew uninstall exponent-xde
10119 brew search xde
10120 brew cask search xde
10121 brew cask install expo-xde
10122 brew install watchman
10123 watchman -h
10124 watchman version
10125 watchman log
10126 brew uninstall watchman
10127 watchman get-sockname
10128 brew uninstall watchman
10129 brew install watchman
10130 watchman -h
10131 watchman get-config && watchman get-pid && watchman get-sockname
10132 watchman get-pid && watchman get-sockname
10133 watchman get-sockname
10134 watchman version
@stephy for homebrew, the logs typically land in /usr/local/var/run/watchman/$USER-state/log. It's easiest to run ps -ef | grep watchman to see what is showing up in the process listing to find this (assuming that the server process is running)
Ok. So, I found a workaround.
I suspect the problem to be something related to the security software installed by my company, in my company's laptop.
If I install watchman locally in the project, I can run my project without any issues. Basically at the moment anything that triggers the global watchman won't work.
I added watchman to my dev path environment.
So, in my project folder:
$ npm install watchman
$ yarn add --dev watchman
Thanks to @dikaiosune who actually figured most of this out and helped me with this issue.
The npm watchman module is not related to the facebook watchman project, and can conflict with it. You probably don't want the npm watchman module, but rather the fb-watchman module? At the very least, you don't want npm/watchman installed globally if you're working with watchman
Most likely due to installing npm/watchman globally, which conflicts with the facebook watchman service (both have the same executable name). Recommendation is to uninstall npm watchman.
My company's laptop runs a security software that blocks watchman for potential data loss. I was able to fix this issue by uninstalling the software.
This error comes when watchman is not running once you install the it. So to run it use the below command.
watchman --foreground --logfile=/dev/stdout
Most helpful comment
My company's laptop runs a security software that blocks watchman for potential data loss. I was able to fix this issue by uninstalling the software.