Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Irfanwani opened this issue Dec 14, 2024 · 7 comments
Open

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

Irfanwani opened this issue Dec 14, 2024 · 7 comments

Comments

@Irfanwani
Copy link

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

@Irfanwani
Copy link
Author

Fixed it by upgrading all the packages (except react, kept it at 18.x as react native doesn't support 19.x yet), though my packages were just a little behind the latest versions, it worked, deleted node_modules, pods and resintalled them .

@codingslash76
Copy link

@Irfanwani I am getting the same error (unable to make archieve) as you mentioned. Below is the package.json and react-native info I am using. Can you please help me what I am missing here?

System:
  OS: macOS 15.2
  CPU: (8) arm64 Apple M1
  Memory: 179.06 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 23.4.0
    path: /opt/homebrew/bin/node
  Yarn: Not Found
  npm:
    version: 10.9.2
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12700392
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.13
    path: /usr/bin/javac
  Ruby:
    version: 3.3.6
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.5
    wanted: ^0.76.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false
{
  
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "postinstall": "patch-package"
  },
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^6.7.1",
    "@fortawesome/free-brands-svg-icons": "^6.7.1",
    "@fortawesome/free-solid-svg-icons": "^6.7.1",
    "@fortawesome/pro-duotone-svg-icons": "^6.7.1",
    "@fortawesome/pro-light-svg-icons": "^6.7.1",
    "@fortawesome/pro-regular-svg-icons": "^6.7.1",
    "@fortawesome/pro-solid-svg-icons": "^6.7.1",
    "@fortawesome/react-native-fontawesome": "^0.3.2",
    "@fortawesome/sharp-light-svg-icons": "^6.7.1",
    "@fortawesome/sharp-regular-svg-icons": "^6.7.1",
    "@gorhom/bottom-sheet": "^4.6.4",
    "@react-native-async-storage/async-storage": "^2.1.0",
    "@react-native-camera-roll/camera-roll": "^7.9.0",
    "@react-native-community/blur": "^4.4.1",
    "@react-native-community/datetimepicker": "^8.2.0",
    "@react-native-community/geolocation": "^3.4.0",
    "@react-native-community/netinfo": "^11.4.1",
    "@react-native-community/slider": "^4.5.5",
    "@react-native-firebase/app": "^18.7.3",
    "@react-native-firebase/messaging": "^18.7.3",
    "@react-native-picker/picker": "^2.4.0",
    "@react-navigation/drawer": "^6.7.2",
    "@react-navigation/native": "^6.1.18",
    "@react-navigation/stack": "^6.4.1",
    "@stripe/stripe-react-native": "^0.38.4",
    "axios": "^1.7.2",
    "buffer": "^6.0.3",
    "deprecated-react-native-prop-types": "^2.3.0",
    "fbjs": "^3.0.5",
    "js-sha256": "^0.11.0",
    "lodash": "^4.17.21",
    "moment": "^2.30.1",
    "native-base": "^3.4.28",
    "prop-types": "^15.8.1",
    "react": "18.3.1",
    "react-native": "^0.76.5",
    "react-native-add-calendar-event": "^5.0.0",
    "react-native-blob-util": "^0.19.11",
    "react-native-camera": "^4.2.1",
    "react-native-detector": "^0.2.3",
    "react-native-document-picker": "^9.3.1",
    "react-native-geolocation-service": "^5.3.1",
    "react-native-gesture-handler": "^2.21.2",
    "react-native-image-crop-picker": "^0.41.6",
    "react-native-image-picker": "^7.2.2",
    "react-native-image-viewing": "^0.2.2",
    "react-native-inappbrowser-reborn": "^3.7.0",
    "react-native-indicators": "^0.17.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-linear-gradient": "^2.8.3",
    "react-native-maps": "^1.20.1",
    "react-native-masonry-list": "^2.16.2",
    "react-native-media-controls": "^2.3.0",
    "react-native-modal": "^13.0.1",
    "react-native-modal-datetime-picker": "^18.0.0",
    "react-native-nfc-manager": "^3.16.1",
    "react-native-pdf": "^6.7.6",
    "react-native-permissions": "^5.2.1",
    "react-native-picker-select": "^9.3.1",
    "react-native-qrcode-scanner": "^1.5.5",
    "react-native-qrcode-svg": "^6.3.12",
    "react-native-quick-actions": "^0.3.13",
    "react-native-reanimated": "^3.15.0",
    "react-native-safe-area-context": "^5.0.0",
    "react-native-screens": "^4.3.0",
    "react-native-share": "^12.0.3",
    "react-native-slider": "^0.11.0",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-sound": "^0.11.2",
    "react-native-svg": "^15.10.1",
    "react-native-swipe-gestures": "^1.0.5",
    "react-native-swipe-list-view": "^3.2.9",
    "react-native-swiper": "^1.6.0",
    "react-native-switch-selector": "^2.3.0",
    "react-native-webview": "^13.12.5",
    "react-native-zohodesk-portal-sdk": "^1.3.6",
    "react-redux": "^9.1.2",
    "redux": "^5.0.1",
    "rive-react-native": "^7.3.0",
    "rn-range-slider": "github:githuboftigran/rn-range-slider#v1"
  },
  "devDependencies": {
    "@babel/core": "^7.25.2",
    "@babel/preset-env": "^7.25.3",
    "@babel/runtime": "^7.25.0",
    "@eslint/compat": "^1.2.4",
    "@react-native-community/cli": "15.0.1",
    "@react-native-community/cli-platform-android": "15.0.1",
    "@react-native-community/cli-platform-ios": "15.0.1",
    "@react-native/babel-preset": "0.76.5",
    "@react-native/eslint-config": "0.76.5",
    "@react-native/metro-config": "0.76.5",
    "@react-native/typescript-config": "0.76.5",
    "@types/react": "^18.2.6",
    "@types/react-test-renderer": "^18.0.0",
    "@welldone-software/why-did-you-render": "^8.0.3",
    "babel-jest": "^29.6.3",
    "babel-plugin-module-resolver": "^5.0.2",
    "eslint": "^9.16.0",
    "jest": "^29.6.3",
    "patch-package": "^8.0.0",
    "prettier": "^3.4.2",
    "react-devtools": "^5.3.1",
    "react-devtools-core": "^5.3.1",
    "react-test-renderer": "18.3.1",
    "typescript": "^5.5.4"
  },
  "engines": {
    "node": ">=18"
  },
  "rnpm": {
    "assets": [
      "./assets/fonts"
    ]
  }
}

@codingslash76
Copy link

Screenshot 2024-12-17 at 11 24 07 AM
Screenshot 2024-12-17 at 11 23 55 AM

@Irfanwani
Copy link
Author

@codingslash76 for me it was the packages, delete node_modules, upgrade your packages, delete pods and reinstall all dependencies (npm i, cd ios, pod install). It should fix the issue

@codingslash76
Copy link

@Irfanwani Thanks for the response.

I have attempted all the steps multiple times without success, even after resetting the entire system.

I have created the following issue.
facebook/react-native#48304

@Irfanwani
Copy link
Author

Did you reinstalled watchman (and delete its cache).

@codingslash76
Copy link

Yes, Multiple times.
It's working fine on simulator (Android and IOS) but the error is there only while creating release build for both OS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants