watchman: EMFILE: too many open files, watch
i’m facing below issue while generating archive in xcode
node:events:371
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 NodeWatcher.checkedEmitError (/Users/igesia/work/mobile/igesia_mobile/node_modules/sane/src/node_watcher.js:143:12)
at FSWatcher.emit (node:events:394:28)
at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:210:12) {
errno: -24,
syscall: 'watch',
code: 'EMFILE',
filename: null
}
i’m on 2021.06.07.00
version of watchman
any idea how to fix this?
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 30
- Comments: 44
I was able to solve this issue on a new M1 Macbook Air by just installing watchman directly with ARM version of brew (the one at
/opt/homebrew/bin/brew
) and tweaking the file descriptor sizes.I didn’t have to change anything else.
i solved this error by following below steps
npm i
cd ios && rm -rf ~/Library/Caches/CocoaPods Pods ~/Library/Developer/Xcode/DerivedData/\*; pod deintegrate; pod setup; pod install --repo-update
This Work for Me
https://stackoverflow.com/a/70177808/6455789
just add this line only
I was also stuck in this error This works for me run this command globally
brew install watchman
I was also facing this issue while building archive in Xcode in my M1 Mac. Fortunately, it had resolved after following these steps:
Install Rosetta2 & Homebrew in non-rosetta mode terminal from the following StackOverflow link
Add this brew to the PATH or you can CD into
/usr/local/Homebrew/bin
and run./brew install watchman
In XCode, Go to
Target > Build Settings > Architectures > Exclude Architectures
. And add these two key-value pairs.Same problem here with the same version
2021.06.07.00
on an Apple Silicon Macbook (m1).But in my case, there is a slight nuance (I don’t know if it’s your case too @deepakverma4):
/usr/local/Homebrew
), no problem to bundle my javascript files./opt/homebrew
), I get theEMFILE: too many open files
errorKnowing that I tried a lot of random things like increasing a lot the ulimit in:
Start Packager
XCode scriptBundle React Native code
XCode scriptsudo launchctl limit maxfiles 65536 unlimited
But nothing worked. 😕
i had the same problem with my M1 and a React Native project i tried to build/archive in Xcode. i first had to
xcode-select --install
but it gave me an estimate of 120 hours so i downloaded it manually from apple. Afterwards i could finally dobrew install watchman
, still had the error while i was trying to build/archive in xcode. After some debugging i found out that Xcode still didnt recognize watchman because it wasnt in its path. (For debugging measures i went toTarget -> Build Phases -> Bundle React Native code and images
and added a linewatchman --version
to check if watchman was recognized) After finding out it didnt, i added to the first line the path to my homebrew.export PATH=/opt/homebrew/bin:$PATH
Then it finally worked 😃If anyone has problems with apple m1, there is a solution that works to me first install apple command line: xcode-select --install then install watchman: brew install watchman That’s all
The above steps to clear cache didn’t work for me.
Thanks so much for this, installing watchman using x86_64 brew and adding it to my
PATH
let me build the app. Additionally, I had to follow this to get watchman working: https://github.com/facebook/watchman/issues/640#issuecomment-416983649Thanks to @techniqs, I fixed my issue by adding
export PATH=/opt/homebrew/bin:$PATH
in the Build Phases > Bundle React Native code & images section.NOTE: Using RN:
0.71.3
The reason is that Xcode runs a clean shell for build tasks, so any PATH updates done in your profile (e.g.
~/.zshrc
) are not sourced and therefore Xcode cannot see the binaries installed via brew (in/opt/homebrew/bin
)in my case , downgrading node from v14 to v12 solved the issue
Hi Salim95,
Thanks for sharing!! Now I can archive in x code
just to reshare, the StackOverflow answer I follow is https://stackoverflow.com/a/64997047/14657391
I came across this error as well
This works for me
thanks to the comments above!
in my case, I just moved my rn project folder to the root folder or /users/{name}
If you are running your terminal with “Open using Rosetta”, then having Xcode “Open using Rosetta” must also be checked and vice versa. This way depending on how people install Watchman (either with arch -arm64 or otherwise) then everything should coalesce.
So, running terminal with “Open using Rosetta”, then installing Watchman via
arch -arm64 brew install watchman
, then running Xcode with “Open using Rosetta” should work.arch -arm64 brew install watchman
Wow, so thats the reason why “too many files” issue reoccurred after Xcode being updated in my case!! Good to know that, finally relieved! 😄
brew install watchman
on Mac M1 solved the issue for me. Did not have to specify the arch.rm -rf node_modules && npm install – > worked for me in android