[macOS] react-native startしたら too many open filesエラー

何もコードを書いていないのにエラーが起きるとテンション下がるよ

エラー表示

nodejsのバージョンは、v12.18.3。react-nativeのバージョンは、0.63.2 です。

react-native startしたら、too many open filesエラーで起動できませんでした。

$ node -v
v12.18.3

$ react-native -v
react-native-cli: 2.0.1
react-native: 0.63.2

$ react-native start
(省略)                                                          
                                                          
                 Welcome to React Native!
                Learn once, write anywhere



To reload the app press "r"
To open developer menu press "d"

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

Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:127:28)
Emitted 'error' event on NodeWatcher instance at:
    at NodeWatcher.checkedEmitError (/Users/xxx/yyy/node_modules/sane/src/node_watcher.js:143:12)
    at FSWatcher.emit (events.js:315:20)
    at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:133:12) {
  errno: -24,
  syscall: 'watch',
  code: 'EMFILE',
  filename: null
}Code language: Bash (bash)

開発環境を用意するのも大変ね

対応方法

homebrewでwatchmanをインストールします。

$ brew install watchmanCode language: Bash (bash)

久しぶりにbrewコマンドを使ったら、brewのupdateで時間がかかってしまったよ。

再度、react-native startしたところ、無事、起動しました。

タイトルとURLをコピーしました