Draft-js: Error: jest-haste-map: Watchman crawl failed. Retrying once with node crawler.

Created on 19 Sep 2019  路  7Comments  路  Source: facebook/draft-js

Do you want to request a feature or report a bug?
bug

What is the current behavior?
When running jest in watch mode on the root directory of the project, jest-haste-map throws an error:

$ yarn test --watch
Using globally installed version of Yarn
yarn run v1.12.1
$ node node_modules/fbjs-scripts/node/check-dev-engines.js package.json
$ cross-env NODE_ENV=test jest --watch
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: resolve_projpath:  None of the files listed in global config root_files are present in path `/Users/procidac/Development/gh/facebook/draft-js/src` or any of its parent directories.  root_files is defined by the `/etc/watchman.json` config file and includes `.watchmanconfig`.  One or more of these files must be present in order to allow a watch. Try pulling and checking out a newer version of the project?. Make sure watchman is running for this project. See https://facebook.github.io/watchman/docs/troubleshooting.html.
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: resolve_projpath:  None of the files listed in global config root_files are present in path `/Users/procidac/Development/gh/facebook/draft-js/src` or any of its parent directories.  root_files is defined by the `/etc/watchman.json` config file and includes `.watchmanconfig`.  One or more of these files must be present in order to allow a watch. Try pulling and checking out a newer version of the project?
    at BunserBuf.<anonymous> (/Users/procidac/Development/gh/facebook/draft-js/node_modules/fb-watchman/index.js:95:23)
    at BunserBuf.emit (events.js:182:13)
    at BunserBuf.process (/Users/procidac/Development/gh/facebook/draft-js/node_modules/bser/index.js:292:10)
    at /Users/procidac/Development/gh/facebook/draft-js/node_modules/bser/index.js:247:12
    at process._tickCallback (internal/process/next_tick.js:61:11)
Emitted 'error' event at:
    at Client.client.on.error (/Users/procidac/Development/gh/facebook/draft-js/node_modules/jest-haste-map/build/lib/WatchmanWatcher.js:130:10)
    at Client.emit (events.js:182:13)
    at BunserBuf.<anonymous> (/Users/procidac/Development/gh/facebook/draft-js/node_modules/fb-watchman/index.js:107:12)
    at BunserBuf.emit (events.js:182:13)
    at /Users/procidac/Development/gh/facebook/draft-js/node_modules/bser/index.js:249:12
    at process._tickCallback (internal/process/next_tick.js:61:11)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

This is similar to https://github.com/facebook/create-react-app/issues/346

What is the expected behavior?
Jest starts in watch mode without errors

Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js?
This is happening in draft-js master with Node v10.14.2

Most helpful comment

I had this issue and it was because my Mac OS upgrade had removed permissions which watchman needed to watch files in the Documents directory. I went into System Preferences > Security & Privacy > Privacy > Files and Folders and manually gave watchman access.

Mas OS version: 10.15.1
Jest version: 22.1.4
watchman version: 4.9.0

All 7 comments

I had this issue and it was because my Mac OS upgrade had removed permissions which watchman needed to watch files in the Documents directory. I went into System Preferences > Security & Privacy > Privacy > Files and Folders and manually gave watchman access.

Mas OS version: 10.15.1
Jest version: 22.1.4
watchman version: 4.9.0

at your root project location:

create a file named as .watchmanconfig
and add {} as it's file content.

I have resolved this by doing this for my project.
and @nigelrobbins3 answer also helped to solve it.

Based on @nigelrobbins3 remark above I ran brew uninstall watchman and brew install watchman to fix the problem.

Don't install your application in the Documents root directory, put it in a folder. It worked for me.

No
Captura de Tela 2020-07-24 a虁s 23 07 15

Yes
Captura de Tela 2020-07-24 a虁s 23 08 03

Based on @nigelrobbins3 remark above I ran brew uninstall watchman and brew install watchman to fix the problem.

brew reinstall watchman

Having the same issue, none of the above worked
Mac 10.15.6
Node 14

I deleted the existing .watchmanconfig and created another one. Problem solved.

Was this page helpful?
0 / 5 - 0 ratings