2

I've been setting up a new M1 MacBook Air with my RN project and have been getting this error in Xcode despite having watchdog installed with homebrew:

+ node /Users/USERNAMAE/RNAPP/node_modules/react-native/cli.js bundle --entry-file index.js --platform ios --dev true --reset-cache --bundle-output /Users/USERNAME/Library/Developer/Xcode/DerivedData/RNAPP-dkmyfsbkdgxjzccgsexwkuiqxsnz/Build/Products/Debug-iphoneos/ReLearn.app/main.jsbundle --assets-dest /Users/USERNAME/Library/Developer/Xcode/DerivedData/RNAPP-dkmyfsbkdgxjzccgsexwkuiqxsnz/Build/Products/Debug-iphoneos/RNAPP.app
warning: the transform cache was reset.
                 Welcome to React Native!
                Learn once, write anywhere


events.js:352
      throw er; // Unhandled 'error' event
      ^

Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:178:28)
Emitted 'error' event on NodeWatcher instance at:
    at NodeWatcher.checkedEmitError (/Users/USERNAME/RNAPP/node_modules/sane/src/node_watcher.js:143:12)
    at FSWatcher.emit (events.js:375:28)
    at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:184:12) {
  errno: -24,
  syscall: 'watch',
  code: 'EMFILE',
  filename: null
}
+ [[ true != true ]]
                 Welcome to React Native!
                Learn once, write anywhere


events.js:352
      throw er; // Unhandled 'error' event
      ^

Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:178:28)
Emitted 'error' event on NodeWatcher instance at:
    at NodeWatcher.checkedEmitError (/Users/username/RNApp/node_modules/sane/src/node_watcher.js:143:12)
    at FSWatcher.emit (events.js:375:28)
    at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:184:12) {
  errno: -24,
  syscall: 'watch',
  code: 'EMFILE',
  filename: null

I tried both Node@16 and Node@14.

Ryan Tremblay
  • 169
  • 1
  • 3
  • 12
  • This post helped me: https://stackoverflow.com/questions/58675179/error-emfile-too-many-open-files-react-native-cli – Mohamed Achraf Younes Jun 24 '21 at 10:04
  • @MohamedAchrafYounes Sadly all of those responses suggested installing/updating Watchman, which I've already done, or using Node12, which I can't do. – Ryan Tremblay Jun 24 '21 at 16:37
  • @RyanTremblay Did you get any solution to fix above too many open files issue? Even we are facing it on react native 0.63.3 and ventura mac os. Is it because of incompatibility between react native and newest version of ventura macos? – Vineeta Jul 27 '23 at 08:56
  • @Vineeta I don't remember the exact solution anymore, but I'd try resetting the watchdog cache by following these instructions: https://facebook.github.io/metro/docs/troubleshooting/ (In case of dead link) Clear Watchman watches: watchman watch-del-all Delete node_modules and run yarn install Reset Metro's cache by passing the --reset-cache flag, or adding resetCache: true to your Metro configuration file. Remove the cache: rm -rf ${TMPDIR:-/tmp}/metro-* Update Metro to the latest version – Ryan Tremblay Jul 31 '23 at 20:31

0 Answers0