Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 
like image 569
Amir Avatar asked Nov 02 '19 20:11

Amir


Video Answer


2 Answers

Just close all other files and try again. If you are running on android make sure to run cd android and ./gradlew clean before react-native run-android. If this doesn't fix, there might be problem with your file watching service. Try this

$ brew update $ brew install watchman 
like image 151
Romit Kumar Avatar answered Sep 22 '22 03:09

Romit Kumar


I'm using a Mac and got the EMFile error. It was resolved when I installed the file watcher

brew install watchman

like image 44
Kaushik Avatar answered Sep 23 '22 03:09

Kaushik