create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

Watchman crawl failed.

Open vjeux opened this issue 10 years ago • 28 comments

I'm running into this error on master with a project created with npm run create-react-app ../test

jest-haste-map: Watchman crawl failed. Retrying once with node crawler. Error: Watchman error: resolve_projpath: none of the files listed in global config root_files are present in path /Users/vjeux/random/test or any of its parent directories. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.html.

screen shot 2016-08-03 at 9 52 57 am

I came up with the "Painless unit testing" sentence. It's now a reality :)

vjeux avatar Aug 03 '16 16:08 vjeux

None of these words make any sense to our users: jest-haste-map watchman crawl node crawler resolve_projpath config root_files. They shouldn’t be in our messages.

If we recommend installing Watchman we should explain why and what it gives you (faster watching)? The message should not include any references to configs and jargon.

gaearon avatar Aug 03 '16 18:08 gaearon

Also the warning links to https://facebook.github.io/watchman/docs/troubleshooting.html which says nothing about how to install Watchman.

https://facebook.github.io/watchman/docs/install.html suggests to use brew or macports which is not at all beginner-friendly.

I think we need a flag to completely disable this warning/suggestion because it’s optional, and instructions are unfortunately confusing. We can still put instructions on “how to speed up watching” in our Howto.

gaearon avatar Aug 03 '16 18:08 gaearon

cc @cpojer

vjeux avatar Aug 03 '16 20:08 vjeux

@vjeux Did you previously install RN? @cpojer told me this warning only shows up if:

  • The folder isn't a Git repo
  • You already have Watchman

gaearon avatar Aug 03 '16 21:08 gaearon

I'm a Facebook engineer so watchman is installed on my machine by default ;)

vjeux avatar Aug 03 '16 22:08 vjeux

Ah that explains it. 😄

gaearon avatar Aug 03 '16 22:08 gaearon

I confirmed that this error is only thrown when using Facebook equipment so I think this isn't actionable and we can close it. I expect FB engineers to figure out how to use watchman, however we might want to improve the error message in Jest to make sure people understand it is no reason to panic.

how to repro a non fb-environment: create ~/watchman and put {} into the file then run: watchman shutdown-server; WATCHMAN_CONFIG_FILE=~/watchman watchman --foreground --logfile=/dev/stdout --no-save-state --statefile=/dev/null

then run jest --no-cache and you shouldn't see the error.

cpojer avatar Aug 04 '16 01:08 cpojer

Thanks for checking.

gaearon avatar Aug 04 '16 11:08 gaearon

For what it's worth, I got this error as well, so it can happen on non-fb equipment. It was because I'd tried jest in the past and ended up with watchman installed on my machine. At least I think that's how I ended up with it. Uninstalling it made the error go away. It would be nice to not ever show this message though. It was cryptic.

pjm17971 avatar Sep 06 '16 17:09 pjm17971

I think we should close this one. I understand the concern but I updated the error message to say to create a .watchmanconfig file in Jest 15. If you have watchman installed manually, I feel like it is ok for Jest to try to use it and tell you how to get rid of the message (git init, hg init or touch .watchmanconfig).

cpojer avatar Sep 06 '16 18:09 cpojer

See https://github.com/facebook/jest/blob/master/packages/jest-haste-map/src/index.js#L403

cpojer avatar Sep 06 '16 18:09 cpojer

Would something like "Watchman is installed but not running. Using standard watcher instead." be less frightening and filled with words I don't understand? Maybe this is all kind of edge case, but I thought it was worth a mention.

pjm17971 avatar Sep 07 '16 01:09 pjm17971

The problem is that we have to surface watchman's error and we can't hide how cryptic it is. Maybe create an issue on watchman's bug tracker about improving their error messages?

cpojer avatar Sep 07 '16 02:09 cpojer

I'm a new user to react-native, just got it installed. The documentation seems to be missing the react-native start step and then I noticed the same watchman warning as in this thread (I'm not a facebook engineer :trollface: ) so I think the docs are still lacking a section about how to improve performance of the watchers in general. My 2c.

saimonmoore avatar Jan 27 '17 17:01 saimonmoore

I came across this issue this morning when running Jest on a different machine. I had no idea I had watchman installed. Looking in my usr/local/bin I found out I installed it back in April 2005 along with React-Native when I was experimenting. I will post an issue with watchman in regards to their error message in hopes they will make it less cryptic.

https://github.com/facebook/watchman/issues/428

epitaphmike avatar Jan 28 '17 15:01 epitaphmike

I found out I installed it back in April 2005 along with React-Native when I was experimenting

Are you a time traveler? 😄

gaearon avatar Feb 24 '17 18:02 gaearon

Don't tell anyone! Though 2015 sounds better.

epitaphmike avatar Feb 24 '17 18:02 epitaphmike

This fixed for me.

npm r -g watchman brew update && brew upgrade brew install watchman

VikramK avatar Jul 05 '17 13:07 VikramK

Hi @cpojer , I tried your instructions:

create ~/watchman and put {} into the file then run: watchman shutdown-server; WATCHMAN_CONFIG_FILE=~/watchman watchman --foreground --logfile=/dev/stdout --no-save-state --statefile=/dev/null

then run jest --no-cache and you shouldn't see the error

And it does not work, btw, 'WATCHMAN_CONFIG_FILE=~/watchman' does not look like a command.

On the other hand, my situation is:

  1. Windows 7 Pro 64-bit,
  2. I previously created a RN app by following the official instructions, and it works in Genymotion, so I have watchman installed globally already.
  3. I checked out a repo from Github, which is a RN boilerplate, and when running it, I got this error, it is not exactly the same as reported by vjeux, in my case it is:

jest-haste-map: Watchman crawl failed. Retrying once with node crawler. Usually this happens when watchman isn't running. Create an empty .watchmanco nfig file in your project's root folder or initialize a git or hg repository in your project. Error: Watchman was not found in PATH. See https://facebook.github.io/watchma n/docs/install.html for installation instructions Watchman: Watchman was not found in PATH. See https://facebook.github.io/watch man/docs/install.html for installation instructions ERROR Watchman was not found in PATH. See https://facebook.github.io/watchman /docs/install.html for installation instructions {"code":"ENOENT","errno":"ENOENT","syscall":"spawn watchman","path":"watchman"," spawnargs":["--no-pretty","get-sockname"]} Error: Watchman was not found in PATH. See https://facebook.github.io/watchman/ docs/install.html for installation instructions at exports._errnoException (util.js:1018:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32) at onErrorNT (internal/child_process.js:367:16) at _combinedTickCallback (internal/process/next_tick.js:80:11) at process._tickCallback (internal/process/next_tick.js:104:9)

  1. I tried uninstalling watchman and re-installing it, not work.
  2. I tried your approach, not work either

I would really appreciate if you can help me out. Thank you.

Vincent-Lz-Zhang avatar Jul 09 '17 01:07 Vincent-Lz-Zhang

My error is slightly different: 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 error: fileData.mtime_ms.toNumber is not a function. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.html. Loading dependency graph, done.

Any ideas on what this means and/or how I can fix it?

shireen avatar Jul 11 '17 21:07 shireen