Skip to content

OS X: "Error: EMFILE: too many open files, watch" when running tests #4540

Closed
@mdr

Description

@mdr

Is this a bug report?

Maybe. This may well not be a create-react-app issue as such, but hoping someone could point me in the right direction.

Environment

Environment:
  OS:  macOS High Sierra 10.13.3
  Node:  10.1.0
  Yarn:  1.6.0
  npm:  5.6.0
  Watchman:  Not Found
  Xcode:  Not Found
  Android Studio:  Not Found

Packages: (wanted => installed)
  react: ^16.4.0 => 16.4.0
  react-dom: ^16.4.0 => 16.4.0
  react-scripts: 1.1.4 => 1.1.4

Steps to Reproduce

  1. npx create-react-app new-app
  2. Add the following dependencies to package.json:
"dependencies": {
    "@material-ui/core": "^1.0.0",
    "@material-ui/icons": "^1.0.0",
    "classnames": "^2.2.5",
    "react": "^16.4.0",
    "react-dom": "^16.4.0",
    "react-router-dom": "^4.2.2",
    "react-scripts": "1.1.4",
    "recompose": "^0.27.1",
    "typeface-roboto": "^0.0.54"
  },
  "devDependencies": {
    "@storybook/addon-actions": "^3.4.5",
    "@storybook/addon-knobs": "^3.4.5",
    "@storybook/addon-links": "^3.4.5",
    "@storybook/addon-notes": "^3.4.5",
    "@storybook/addons": "^3.4.5",
    "@storybook/react": "^3.4.5",
    "babel-core": "^6.26.3",
    "babel-runtime": "^6.26.0",
    "cypress": "^2.1.0",
    "react-test-renderer": "^16.4.0"
  },
  1. Run yarn test

Expected Behavior

Tests are executed.

Actual Behavior

$ yarn test
yarn run v1.6.0
(node:1262) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
$ react-scripts test --env=jsdom
2018-05-30 13:31 node[1264] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2018-05-30 13:31 node[1264] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2018-05-30 13:31 node[1264] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (fs.js:1352:28)
Emitted 'error' event at:
    at FSEvent.FSWatcher._handle.onchange (fs.js:1358:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Other

I've tried first raising the limit of open files to 65536, but still get the above error:

$ ulimit -a
...
open files                      (-n) 65536
...

Any ideas on how to work around this? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions