Metro: [Apple M1] Don't compile on IOS metro-hermes-compiler too many open files

Created on 25 Apr 2021  路  5Comments  路  Source: facebook/metro

Bug Description

  • Hermes version: 0.7.2
  • React Native version: 0.64.0
  • OS version: macOS 11.2.3
  • Platform: arm64 (Apple M1)

Steps To Reproduce

  1. Update existing project from 0.63.4 to 0.64.0
  2. Compile with Xcode

The Expected Behavior

Pre-version compiles fine

Error Message

Showing All Messages
+ PACKAGER_SOURCEMAP_FILE=

+ [[ '' == true ]]

+ /Users/alexander/Code/Sputnik/sputnik-app/node_modules/@sentry/cli/sentry-cli /Users/alexander/Code/Sputnik/sputnik-app/node_modules/react-native/cli.js bundle --entry-file index.js --platform ios --dev false --reset-cache --bundle-output /Users/alexander/Library/Developer/Xcode/DerivedData/SputnikApp-fjypaeaptflxsubdwkhkfnnxdzqv/Build/Products/Release-iphonesimulator/main.jsbundle --assets-dest $'/Users/alexander/Library/Developer/Xcode/DerivedData/SputnikApp-fjypaeaptflxsubdwkhkfnnxdzqv/Build/Products/Release-iphonesimulator/\320\241\320\277\321\203\321\202\320\275\320\270\320\272.app' --sourcemap-output /Users/alexander/Library/Developer/Xcode/DerivedData/SputnikApp-fjypaeaptflxsubdwkhkfnnxdzqv/Build/Intermediates.noindex/SputnikApp.build/Release-iphonesimulator/SputnikApp.build/DerivedSources/main.jsbundle.map

                    Welcome to Metro!

              Fast - Scalable - Integrated

/Users/alexander/Code/Sputnik/sputnik-app/node_modules/metro-hermes-compiler/src/emhermesc.js:81
          throw ex;
          ^

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/alexander/Code/Sputnik/sputnik-app/node_modules/sane/src/node_watcher.js:143:12)
    at FSWatcher.emit (node:events:369:20)
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:210:12) {
  errno: -24,
  syscall: 'watch',
  code: 'EMFILE',
  filename: null
}
the transform cache was reset.
Command PhaseScriptExecution failed with a nonzero exit code

Additional Info

Newly created React Native project is being compiled successfully. The issue only with a existing project.

Most helpful comment

fsevents is the module that causes it to break. Upgrade fsevents to fix it:

// yarn.lock
fsevents@^2.1.2:
-  version "2.1.3"
-  resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e"
-  integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==
+  version "2.3.2"
+  resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
+  integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==

All 5 comments

+1 i also get this error on M1

warning: the transform cache was reset.
                    Welcome to Metro!
              Fast - Scalable - Integrated


/Users/gedeagas/Work/Kumparan/kumparan-mobile-app/node_modules/metro-hermes-compiler/src/emhermesc.js:81
          throw ex;
          ^

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/gedeagas/Work/Kumparan/kumparan-mobile-app/node_modules/sane/src/node_watcher.js:143:12)
    at FSWatcher.emit (node:events:378:20)
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:210:12) {
  errno: -24,
  syscall: 'watch',
  code: 'EMFILE',
  filename: null
}

Same problem

try deleting the yarn.lock file and peforming yarn install

fsevents is the module that causes it to break. Upgrade fsevents to fix it:

// yarn.lock
fsevents@^2.1.2:
-  version "2.1.3"
-  resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e"
-  integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==
+  version "2.3.2"
+  resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
+  integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==

@JonnyBurger @owinter86 fsevents upgrade to 2.1.3 works like a charm, many thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Naturalclar picture Naturalclar  路  4Comments

aleclarson picture aleclarson  路  4Comments

samuela picture samuela  路  4Comments

skovhus picture skovhus  路  6Comments

cpojer picture cpojer  路  3Comments