Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FSEvents error when running create-react-native-app tests

I am getting the following errors when running yarn run test on a create-react-native-app:

$ yarn run test
yarn run v1.0.1
$ node node_modules/jest/bin/jest.js --watch
2017-09-13 14:53 node[2839] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-09-13 14:53 node[2839] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-09-13 14:53 node[2839] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-09-13 14:53 node[2839] (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:1282:11)
Segmentation fault: 11

Googling about, it seems something to do with OSX Sierra (I am on version 10.12.6) and Watchman. Some recommend increasing max file limits, which I have done, and upgrading watchman, which I have tried to do but without success.

I haven't actually installed watchman myself, I think it comes bundled as part of create react native app.

Node is installed via nvm and I have tried with v7.2.1 and 8.2.1

Any help would be amazing.

Thank you.

like image 445
Le Moi Avatar asked Sep 13 '17 14:09

Le Moi


1 Answers

I also had this issue.

You may not have 'watchman' package installed correctly.

Check you don't have watchman installed with npm or yarn. Then installed watchman with brew.

Everything then worked fine. I also installed jest-cli package and this works really nice with testing.

I hope this helps.

like image 183
philipjc Avatar answered Oct 15 '22 18:10

philipjc