Testing with Jest failed with Error: Error watching file for changes: EMFILE

I have ran into the same problem and upgrade watchman didn't fix this for me. Reading the documentation of Jest, you will find there is an option to disable using watchman. So I guess watchman is not necessary.

What fixed this for me is to upgrade Jest to the lastest version using npm install --save-dev jest@latest.


Oh, I am going to answer my question after hours of my struggling.
The best solution is to install the latest version of Watchman.
The old version of Watchman causes fsevents module throws the exception.

After installing watchman, optionally you can run sudo chown -R $(whoami):staff ~/Library/LaunchAgents to give the permission.


Do you have watchman installed? I recently had a colleague spill water in my laptop, so after migrating projects etc to a new laptop I had a similar issue. I realised after a bit of head-scratching that i just needed to run brew install watchman, assuming that you have homebrew of course.