React Native: Error: watch EMFILE
After updating macOS, you may run into the following problem when trying to run a React Native project:
ERROR watch EMFILE
{"code":"EMFILE","errno":"EMFILE","syscall":"watch"}
Error: watch EMFILE
at exports._errnoException (util.js:746:11)
at FSWatcher.start (fs.js:1172:11)
at Object.fs.watch (fs.js:1198:11)
at NodeWatcher.watchdir (/node_modules/react-native/node_modules/sane/src/node_watcher.js:144:20)
at Walker.<anonymous>
The issue stems from incorrect folder permissions being set for watchman
after the update.
As covered in this ticket, fully reinstalling the file watching utility solves the problem:
rm -rf /usr/local/var/run/watchman/
brew uninstall watchman
brew install watchman