macos – React Native Expo on MacBook M1: “EMFILE: too many open files, watch” error during development

Solution:

Ensure all development environment dependencies (Node.js, Watchman, etc.) are installed correctly using Homebrew.

brew install node

brew install watchman

After setting up your environment, make sure that:

Watchman has the appropriate disk access permissions (Proper full disk access).
You need to grant full disk access to watchman to allow it to watch the locations you’ve asked it to watch.

Go to ‘System preferences’ -> ‘Security & Privacy’ -> scroll down and click ‘Full Disk Access’, and then check ‘Watchman’.

Clone your existing Expo React Native project from GitHub.
Remove testing libraries like Jest or React Native Testing Library if they are not needed, as they may cause compatibility issues.

After changing this, restart your laptop.

Clean your code, remove unnecessary libraries, and run:

npm install

npm start (to launch the Expo server)

After doing this, the issue was resolved, and my project started running smoothly on the M1 chip.

Read more here: Source link