Skip to content

Error: EMFILE: too many open files, watch #1405

Description

@Irfanwani

Bug Report
I upgraded the app to the new arch (0.76.x) and now I am getting this error when trying to archive in xcode:


node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:204:21)
Emitted 'error' event on NodeWatcher instance at:
    at FSWatcher._checkedEmitError (node_modules/metro-file-map/src/watchers/NodeWatcher.js:82:12)
    at FSWatcher.emit (node:events:513:28)
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:210:12) {
  errno: -24,
  syscall: 'watch',
  code: 'EMFILE',
  filename: null
}

What is the current behavior?
App works fine, in dev as well as in release mode on both android as well as in iOS. First i was getting this error in terminal too when running npm start but that was fixed by deleting node_modules and reinstalling deps but archiving is still throwing this error.

If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test.
Set Run scheme to Release and change run destination to Any iOS device, and try to archive.

What is the expected behavior?
Archive should be executed successfully instead of throwing a metro bundler error.

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
metro - v0.81.0
node - v22.11.0
npm - v10.9.0
react-native - 0.76

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions