Error when archiving in XCode: EMFILE
See original GitHub issueThis error has been reported before, but the solution did not help me.
Description
I am seeing this error when archiving from XCode. I have not encountered this issue before and have tried reverting my code:
node /.../node_modules/react-native/cli.js bundle --entry-file index.js --platform ios --dev false --reset-cache --bundle-output ... --assets-dest ...
warning: the transform cache was reset.
Welcome to React Native!
Learn once, write anywhere
events.js:288
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/.../node_modules/sane/src/node_watcher.js:143:12)
at FSWatcher.emit (events.js:311:20)
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:133:12) {
errno: -24,
syscall: 'watch',
code: 'EMFILE',
filename: null
}
I have tried the following steps to fix:
- Reinstall Watchman (
sudo port uninstall watchman,sudo port install watchman, reboot) (this has been the solution on similar issues but has not helped me) - Reset Cocoapods (Deintegrate, rm Pods/, reinstall etc)
- Reset Watchman Cache (watchman watch-del-all)
- Clean Build Folder in XCode
If I run the bundle command manually from terminal it succeeds, it only seems to have a problem when archiving from XCode.
I also run npx react-native doctor and there is a ✅ next to Watchman
Versions:
Environment: macOS Catalina React Native CLI Version: 4.10.1 Node Version 12.16.1 React Native Version: 0.63.2 Watchman Version: 4.9.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:18 (1 by maintainers)
Top Results From Across the Web
"Error: EMFILE: too many open files" using Xcode to archive ...
I'm trying to build an archive of a React Native App from Xcode and, since updating to macOS 11.3.1 and Xcode 12.5, I...
Read more >Xcode 13 archive Error | Apple Developer Forums
Xcode13 has no errors when tested on the IOS 15 real machine, and there are errors when packaging, and there is no problem...
Read more >too many open files" using Xcode to archive React Native App
I'm trying to build an archive of a React Native App from Xcode and, since updating to macOS 11.3.1 and Xcode 12.5, I...
Read more >“xcode Error: EMFILE: too many open files, watch at FSEvent ...
Answers related to “xcode Error: EMFILE: too many open files, watch at FSEvent.FSWatcher._handle.onchange”.
Read more >Error: EMFILE: too many open files - Expo forums
Running 'expo start' suddenly gives this error: Expo Press ? to show a list of all available commands. Logs for your project will...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Works for me with same error on latest version of watchman error.
I don’t know your environment and what device you are using but I will list the things to keep in mind:
Also look at this thread: https://github.com/facebook/metro/issues/668
These are the steps I followed to make the project archive in xcode. Note that the project would compile fine in simulator outside of xcode before but the above steps finally got it to archive in xcode where it was failing
EDIT: Also if everything fails then please reset your device, install all latest versions of software needed, follow above steps and then create a clean react-native project using latest watchman and all tools and see if it archives properly. Some people I know have reported success in this method compared to working with existing projects. If this works you can then slowly start figuring out which module is causing problem in existing project.