Skip to content

Watchman crawl failed. #346

@vjeux

Description

@vjeux
Contributor

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

Activity

gaearon

gaearon commented on Aug 3, 2016

@gaearon
Contributor

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

gaearon commented on Aug 3, 2016

@gaearon
Contributor

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.

added this to the 0.3.0 milestone on Aug 3, 2016
vjeux

vjeux commented on Aug 3, 2016

@vjeux
ContributorAuthor
gaearon

gaearon commented on Aug 3, 2016

@gaearon
Contributor

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

vjeux commented on Aug 3, 2016

@vjeux
ContributorAuthor

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

gaearon

gaearon commented on Aug 3, 2016

@gaearon
Contributor

Ah that explains it. 😄

self-assigned this
on Aug 4, 2016
cpojer

cpojer commented on Aug 4, 2016

@cpojer
Contributor

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.

gaearon

gaearon commented on Aug 4, 2016

@gaearon
Contributor

Thanks for checking.

removed this from the 0.3.0 milestone on Sep 1, 2016
pjm17971

pjm17971 commented on Sep 6, 2016

@pjm17971

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.

10 remaining items

epitaphmike

epitaphmike commented on Feb 24, 2017

@epitaphmike

Don't tell anyone! Though 2015 sounds better.

VikramK

VikramK commented on Jul 5, 2017

@VikramK

This fixed for me.

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

Vincent-Lz-Zhang

Vincent-Lz-Zhang commented on Jul 9, 2017

@Vincent-Lz-Zhang

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.

shireen

shireen commented on Jul 11, 2017

@shireen

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?

valetarton

valetarton commented on Aug 11, 2017

@valetarton

@shireen I am having the exact same error

rttomlinson

rttomlinson commented on Oct 11, 2017

@rttomlinson

@shireen @valetarton I'm running into this issue now. Did ya'll figure out a solution or workaround?
My specific error is Error: Watchman error: query failed: synchronization failed: Unknown error.

I'm on Windows 7. Thanks

lvlinhaohan2010

lvlinhaohan2010 commented on Oct 30, 2017

@lvlinhaohan2010

it fixed in my solution:

$ brew uninstall watchman
$ brew install watchman
Warning: watchman 4.9.0 is already installed, it's just not linked.
$ brew unlink watchman
$ brew link --overwrite watchman

re init react-native project,it will work.

arnoldbird

arnoldbird commented on Apr 4, 2018

@arnoldbird

Still having this issue. The solutions presented above do not work for me. I tried Vikram's solution and lvlinha's solution. I still see the same error message. I also have created a .watchman file in my project root as instructed by the message, to no avail.

UPDATE: Fixed when I did some module upgrades. Not sure what fixed it, but I upgraded to npm ^5.8.0, react ^16.3.0, and expo SDK v26.

UPDATE: Nope, it's still happening, but it depends on if I run react-native run-ios as root or not. If I run the simulator as root, I don't get the watchman error, but the packager behaves strangely... very labored. If I don't run it as root, I get the error but the packager runs smoothly and the simulator loads much more quickly. I guess the upgrades didn't help.

UPDATE: Fixed by recursively changing the owner of .git to my non-root user.

Manoj002

Manoj002 commented on May 25, 2018

@Manoj002

After reading all comments and implementing them again getting same error

expo: 27.0.1
react: 16.3.1
react-native: 0.55.2

theapache64

theapache64 commented on Jun 19, 2018

@theapache64

watchman shutdown-server worked for me.

Manoj002

Manoj002 commented on Jun 19, 2018

@Manoj002

i simply copied the code from my project, created a new project and pasted there...
and it works:)
UPDATE:
@theapache64 ,
I guess after i ran "npm audit" and resolved some vulnerabilities after that watchman stopped working in that project and when i created new project, copied the code from previous project and run the packager, it worked (:

ajmalpkc

ajmalpkc commented on Jun 21, 2018

@ajmalpkc

@theapache64 worked for me too.

added a commit that references this issue on Aug 30, 2018
aadae6a
locked and limited conversation to collaborators on Jan 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @saimonmoore@cpojer@vjeux@epitaphmike@gaearon

        Issue actions

          Watchman crawl failed. · Issue #346 · facebook/create-react-app