cli icon indicating copy to clipboard operation
cli copied to clipboard

Please replace with a clear and descriptive title

Open yongqi-ess opened this issue 5 months ago • 1 comments

Describe the bug

Error: EMFILE: too many open files, watch '/Users/yonqgi.zhang/Desktop/planb-consumer-app-react/ios/DerivedData/7C3C2986-240E-40D3-A4A9-2752D6D9E7FC/Index.noindex/DataStore/v5/units/_complex-2Y0OU8A4C9NRD.pcm-3JYZV9KIPWCYD' at FSWatcher. (node:internal/fs/watchers:254:19) at watch (node:fs:2549:36) at createFsWatchInstance (file:///Users/yonqgi.zhang/.nvm/versions/node/v22.18.0/lib/node_modules/netlify-cli/node_modules/chokidar/esm/handler.js:126:16) at setFsWatchListener (file:///Users/yonqgi.zhang/.nvm/versions/node/v22.18.0/lib/node_modules/netlify-cli/node_modules/chokidar/esm/handler.js:171:19) at NodeFsHandler._watchWithNodeFs (file:///Users/yonqgi.zhang/.nvm/versions/node/v22.18.0/lib/node_modules/netlify-cli/node_modules/chokidar/esm/handler.js:325:22) at NodeFsHandler._handleFile (file:///Users/yonqgi.zhang/.nvm/versions/node/v22.18.0/lib/node_modules/netlify-cli/node_modules/chokidar/esm/handler.js:391:29) at NodeFsHandler._addToNodeFs (file:///Users/yonqgi.zhang/.nvm/versions/node/v22.18.0/lib/node_modules/netlify-cli/node_modules/chokidar/esm/handler.js:615:31)

System: OS: macOS CPU: (8) arm64 Apple M2

Steps to reproduce

run 'netlify dev'

Image

Configuration

No response

Environment

System: OS: macOS 15.5 CPU: (8) arm64 Apple M2 Memory: 189.22 MB / 8.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 22.18.0 - ~/.nvm/versions/node/v22.18.0/bin/node npm: 10.9.3 - ~/.nvm/versions/node/v22.18.0/bin/npm npmPackages: netlify-cli: ^23.0.0 => 23.0.0 npmGlobalPackages: netlify-cli: 23.4.3

Image

yongqi-ess avatar Sep 18 '25 04:09 yongqi-ess

@yongqi-ess I have the same issue

Hardware:

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: MacBookPro17,1
      Model Number: Z11C0005PB/A
      Chip: Apple M1
      Total Number of Cores: 8 (4 performance and 4 efficiency)
      Memory: 16 GB
      System Firmware Version: 13822.1.2
      OS Loader Version: 13822.1.2
      Serial Number (system): FVFGM4T3Q05P
      Hardware UUID: 0690F9B6-09A4-580B-9F47-463B77B66194
      Provisioning UDID: 00008103-0009089622FB001E
      Activation Lock Status: Enabled

My command just continually spits out the ’Netlify has terminated unexpectedly’ message without any supporting informaton, however by modifying the catch block in commands/dist/main.js I managed to capture the following output:

"Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)""Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)""Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)""Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)""Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)""Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)""Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)""Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)""Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)""Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)""Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)""Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)""Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)""Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)""Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)""Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)""Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (node:internal/fs/watchers:207:21)""Error: spawn EBADF
    at ChildProcess.spawn (node:internal/child_process:420:11)
    at spawn (node:child_process:753:9)
    at Object.execFile (node:child_process:346:17)
    at Object.exec (node:child_process:233:25)
    at /Users/srmes/.config/yarn/global/node_modules/envinfo/dist/envinfo.js:1:39378
    at new Promise (<anonymous>)
    at l (/Users/srmes/.config/yarn/global/node_modules/envinfo/dist/envinfo.js:1:39351)
    at m (/Users/srmes/.config/yarn/global/node_modules/envinfo/dist/envinfo.js:1:39995)
    at Object.getDarwinApplicationVersion (/Users/srmes/.config/yarn/global/node_modules/envinfo/dist/envinfo.js:1:42429)
    at a (/Users/srmes/.config/yarn/global/node_modules/envinfo/dist/envinfo.js:1:6855)""Error: spawn EBADF
    at ChildProcess.spawn (node:internal/child_process:420:11)
    at spawn (node:child_process:753:9)
    at Object.execFile (node:child_process:346:17)
    at Object.exec (node:child_process:233:25)
    at /Users/srmes/.config/yarn/global/node_modules/envinfo/dist/envinfo.js:1:39378
    at new Promise (<anonymous>)
    at l (/Users/srmes/.config/yarn/global/node_modules/envinfo/dist/envinfo.js:1:39351)
    at m (/Users/srmes/.config/yarn/global/node_modules/envinfo/dist/envinfo.js:1:39995)
    at Object.getDarwinApplicationVersion (/Users/srmes/.config/yarn/global/node_modules/envinfo/dist/envinfo.js:1:42429)
    at getEdgeInfo (/Users/srmes/.config/yarn/global/node_modules/envinfo/dist/envinfo.js:1:9125)""Error: spawn EBADF
    at ChildProcess.spawn (node:internal/child_process:420:11)
    at spawn (node:child_process:753:9)
    at Object.execFile (node:child_process:346:17)
    at Object.exec (node:child_process:233:25)
:

I used the following code to get it:

L66++
  }
  else {
    console.error(err.stack);
    try {
      fs.writeFileSync('/tmp/node_error.log', JSON.stringify(err.stack), { flag: 'a+' });
    } catch (e) {
      console.error(e);
    }
    /** 
      logError(`${chalk.red('Netlify CLI has terminated unexpectedly')}\nThis is a problem with the Netlify CLI, not with your application.\nIf you recently updated the CLI, consider reverting to an older version by running:\n\n${chalk.bold('npm install -g netlify-cli@VERSION')}\n\nYou can use any version from ${chalk.underline('https://ntl.fyi/cli-versions')}.\n\nPlease report this problem at ${chalk.underline('https://ntl.fyi/cli-error')} including the error details below.\n`);
      console.log(chalk.dim(err.stack || err));
    **/
    const systemInfo = await getSystemInfo();
    console.error(chalk.dim(systemInfo));
    // reportError(err, { severity: 'error' });
  }

It seems that envinfo is causing the issue for me

ScottA38 avatar Oct 31 '25 15:10 ScottA38