Search code examples
react-nativereact-native-ios

Error: EMFILE: too many open files - React Native CLI


I try to run a react-native-cli project using react-native start, and the metro bundler fails, saying the following:

events.js 187
throw er; //Unhandled 'error' event

Error: EMFILE: too many open files, watch

Emitted 'error' event on NodeWatcher isntance at:
     at NodeWatcher: checkedEmitError (.../react-native-project/node_modules/sane/src/node_watcher.js:143:12)
     at FSWatcher.emit (events.js:210:5)
     at FSEvent.FSWatcher:_handle onchange (internal/fs/watchers.js:129:12) {
   errno: -24,
   syscall: 'watch',
   code : 'EMFILE',
   filename: null
)
Process terminated. Press <enter> to close the window

Solution

  • In my case, upgrading watchman did not help.

    This problem started to happen after having updated Node.js.

    Thanks to nvm, I came back to node v8.11.3 (I updated to v12.0.4) and this issue disappeared.

    That might help some of you having the same problem...