Testing error using Jest with the error: Error viewing the file for changes: EMFILE

I tried to write a test for a React.js application. Everything went well, but after the directory was tracked using Git (made a Git repository with it). Test failed with error below

2017-01-15 05:05 node[1278] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22) 2017-01-15 05:05 node[1278] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22) events.js:160 throw er; // Unhandled 'error' event ^ Error: Error watching file for changes: EMFILE at exports._errnoException (util.js:1022:11) at FSEvent.FSWatcher._handle.onchange (fs.js:1406:11) 

I am sure that this is because of the .git directory, because when I delete the .git directory, it works without error. It seems that an exception occurs when viewing files. My development environment is MacOS 10.12.2 and Node 6.9.4. How can I solve this problem?

+8
ecmascript-6 reactjs jestjs
source share
2 answers

Oh, I'm going to answer my question after several hours of my struggle.
The best solution is to install the latest version of Watchman .
An old version of Watchman calls the fsevents module to fsevents an exception.

+10
source share

For me it was a permission problem, when you install a watchman with a homegrown, says that you should try brew postinstall watchman. When you do this, you will notice a permission error. Error: Permission denied - /usr/local/var/run/watchman sudo chown -R "$USER":admin /usr/local/var/run

solve the permission problem and then

 brew postinstall watchman 

will work

0
source share

All Articles