Iranna Patil
Iranna Patil

Reputation: 1

React Native Expo on MacBook M1: "EMFILE: too many open files, watch" error during development

I'm developing a React Native app using Expo on a MacBook Pro with the M1 chip. My development environment includes VS Code and all the necessary React Native and Expo dependencies. However, I'm encountering the following error when trying to run the app:

error: EMFILE: too many open files, watch at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)

see error image

I've made sure that:

Node.js and Watchman are installed via Homebrew

Upvotes: -1

Views: 442

Answers (1)

Iranna Patil
Iranna Patil

Reputation: 1

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.

Upvotes: 0

Related Questions