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: Error watching file for changes: EMFILE #3436

Closed
kirkstrobeck opened this issue May 2, 2017 · 23 comments
Closed

Error: Error watching file for changes: EMFILE #3436

kirkstrobeck opened this issue May 2, 2017 · 23 comments

Comments

@kirkstrobeck
Copy link

kirkstrobeck commented May 2, 2017

I know others have posted this issue, but it seems that they are aging and using old versions. I have tried everything from other issues.

Here is the error I get:

$ jest --watch # or with $ jest --watch --no-watchman
2017-05-02 09:49 node[8980] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-05-02 09:49 node[8980] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-05-02 09:49 node[8980] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: Error watching file for changes: EMFILE
    at exports._errnoException (util.js:1050:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1376:11)
error Command failed with exit code 1.

Versions:

  • node: v7.9.0
  • jest: 19.0.2
  • watchman: 4.7.0 (installed via brew)
  • mac: Sierra 10.12.4 (16E195)
@kirkstrobeck
Copy link
Author

kirkstrobeck commented May 3, 2017

This problem exists with the following versions

  • 19.0.2
  • 19.0.1
  • 19.0.0

It works in

  • 18.1.0

@thymikee
Copy link
Collaborator

thymikee commented May 8, 2017

Does it happen in v20?

@kirkstrobeck
Copy link
Author

Yes, the error is present in v20.0.0.

2017-05-08 05:30 node[6062] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-05-08 05:30 node[6062] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-05-08 05:30 node[6062] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: Error watching file for changes: EMFILE
    at exports._errnoException (util.js:1050:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1376:11)
error Command failed with exit code 1.

@thymikee
Copy link
Collaborator

thymikee commented May 8, 2017

And have you tried it with watchman (brew install watchman)?

@kirkstrobeck
Copy link
Author

Yes

@thymikee
Copy link
Collaborator

thymikee commented May 8, 2017

Any chance for a repro? It's hard to debug without it :(

@joevandyk
Copy link

brew install watchman worked for me.

@renchap
Copy link
Contributor

renchap commented May 28, 2017

Same here, it did not work with jest --watch or jest --watch --no-watchman (watchman was not installed):

2017-05-28 18:57 node[17087] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-05-28 18:57 node[17087] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-05-28 18:57 node[17087] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: Error watching file for changes: EMFILE
    at exports._errnoException (util.js:1050:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1374:11)

I installed watchman using brew, and jest --watch now works. jest --watch --no-watchman still fails.

Jest v20.0.4
Node v7.10.0
MacOS 10.12.5

@fitfab
Copy link

fitfab commented May 30, 2017

I get similar error when i install "pact" and then i tried to run npm test. I using create-react-app to setup my project and using node v7.9.0

@thisconnect
Copy link

new sane version fixed this error for me see amasad/sane#97 (comment)

@wayneseymour
Copy link

Same problem,
MAC OS X Sierra
Node v7.8.0
Jest ^20.0.4

@melkristian
Copy link

brew install watchman worked for me too using NodeJS v6.9 but what I don't understand is the watchman dependence itself. Is this a dependency of the NodeJS version on Mac OS X Sierra? Where does this fit in the dependency tree?

gnidan added a commit to truffle-box/react-box that referenced this issue Jul 6, 2017
gnidan added a commit to truffle-box/react-uport-box that referenced this issue Jul 6, 2017
OnlyOneJMJQ added a commit to truffle-box/react-box that referenced this issue Jul 6, 2017
OnlyOneJMJQ added a commit to truffle-box/react-uport-box that referenced this issue Jul 6, 2017
@kirkstrobeck
Copy link
Author

#1767 (comment)

@Premjeet-Singh
Copy link

brew install watchman worked for me.

@gazzwi86
Copy link

I had this error, but found that if I changed the command I used to run jest in watch mode, it worked.

"test": "jest",
"test:watch": "npm run test -- --watch",

became:

"test": "jest",
"test:watch": "npm run test --watch",

J22Melody added a commit to J22Melody/test-fullstack that referenced this issue Jan 11, 2018
J22Melody added a commit to J22Melody/test-fullstack that referenced this issue Jan 11, 2018
@darylshy
Copy link

brew install watchman worked... until it didn't... :-/ quit my tests and ran it again. And we're back at square one. uninstalled watchman, reinstalled watchman. no-dice.

@thujone
Copy link

thujone commented May 30, 2018

brew install watchman worked for me. And I think watchman had gotten broken somehow because I accidentally closed a terminal window while installing a react package using npm. Clean installing everything both in the project and globally didn't seem to help, but re-installing watchman did.

@Leotw
Copy link

Leotw commented Jun 24, 2018

Yeah! brew install watchman for work

@zxzl
Copy link

zxzl commented Jul 17, 2018

Yeah! brew install watchman for work (2)

@kateryname
Copy link

Yeah! brew install watchman for work (3)

@amandapouget
Copy link

ditto to watchman

@carmanchris31
Copy link

I had this error, but found that if I changed the command I used to run jest in watch mode, it worked.

"test": "jest",
"test:watch": "npm run test -- --watch",

became:

"test": "jest",
"test:watch": "npm run test --watch",

The extra -- is the delimiter that tells npm to forward the remaining parameters to the referenced script.

npm run test -- --watch would run jest --watch but npm run test --watch would ignore the argument and just run jest. You can verify this in your console output.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests