create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

Error npm test on MacOs Sierra

Open manuelitox opened this issue 10 years ago • 24 comments

Hey there,

I can't run with success the npm test command:

❯ npm test

> react-scripts test --env=jsdom
Determining test suites to run...2016-10-07 11:38 node[873] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-10-07 11:38 node[873] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: Error watching file for changes: EMFILE
    at exports._errnoException (util.js:953:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1400:11)
npm ERR! Test failed.  See above for more details.

Environment

Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts: [email protected]
  2. node -v: v6.7.0
  3. npm -v: 3.10.3
  4. Operating system: MacOs Sierra

Any idea?

manuelitox avatar Oct 07 '16 16:10 manuelitox

The issue was fixed to installing of watchman.

manuelitox avatar Oct 07 '16 16:10 manuelitox

Thanks for information! Yeah unfortunately it will likely take some time for the underlying dependencies to fix all Sierra issues.

gaearon avatar Oct 07 '16 20:10 gaearon

In case the specificity helps anyone, I ran:

  • sudo chown -R $(whoami) /usr/local
  • brew update
  • brew install watchman

Peterlollo avatar Oct 10 '16 14:10 Peterlollo

Haha I just had this issue and your comment fixed it. Thanks!

gaearon avatar Nov 16 '16 13:11 gaearon

Another data point: I just had this on Node 6.9.1 but not on 6.3.1.

gaearon avatar Jan 05 '17 18:01 gaearon

Installing watchman fixed it as mentioned above. If you get a password prompt enter your password then run all commands again. And if it's not obvious -- close and reopen your terminal or terminal tab after installing.

jeff3dx avatar Aug 11 '17 17:08 jeff3dx

I had this same issue on node v8.3.0 & OSX v10.12.6 after pulling some changes in my project. However, I'm using yarn v1.0.1. What I've done to fix it is:

rm -rf ./node_modules
yarn cache clean
yarn

After that running yarn test works as before.

afarriaga avatar Sep 26 '17 10:09 afarriaga

Thank you @Peterlollo !

arcecio avatar Nov 01 '17 15:11 arcecio

brew install watchman

worked for me, using high Sierra 10.13.1

packetstracer avatar Nov 23 '17 17:11 packetstracer

well just spent 1.5 hours trying to get the test runner to work. brew install watchman saved the day.

mgan59 avatar Nov 24 '17 19:11 mgan59

Amazing work on finding that watchman is the case! But... Is it only me? I feel like we're correcting symptoms ~ shouldn't watchman be

  1. Included in the create-react-app build process ?
  2. Mentioned in the documentation that watchman is required to run tests?

I'm not sure this should be closed.

etiennejcharles avatar Jan 09 '18 20:01 etiennejcharles

It's not required. The problem is that when it's not available, the alternative watcher doesn't always work and can die unexpectedly. The good news is we're updating to Jest 22 soon which falls back to yet another watcher when watchman isn't available—which doesn't have this issue.

gaearon avatar Jan 10 '18 12:01 gaearon

So this should all go away in the next major release.

gaearon avatar Jan 10 '18 12:01 gaearon

@villesau still having the same issue as well, watchman doesn't fix the issue either.

eddieduro avatar Mar 17 '18 02:03 eddieduro

I am also still having this issue. [email protected], [email protected], [email protected], [email protected]

andrewtpoe avatar Mar 21 '18 15:03 andrewtpoe

For me at least, it turned out I had an older version of watchman installed globally in npm. Uninstalling that got me working again.

andrewtpoe avatar Mar 21 '18 15:03 andrewtpoe

Still having the same issue, installing Watchman didn't help. Any ideas guys ?

maciekgrzybek avatar Mar 27 '18 15:03 maciekgrzybek

I'm currently having this issue. Installing watchman via Brew does eliminate the error, but for some reason Jest can't find my tests so I uninstalled it. I noticed that this problem started as I was making my latest commit, so I tried moving my .git folder out of my project. Lo-and-behold, watching tests works just fine. Moving it back in breaks the tests again.

PorgJuice avatar Mar 28 '18 13:03 PorgJuice

I got the same error using Travis CI :(

yashka713 avatar Mar 29 '18 19:03 yashka713