Create-react-app: macOS Sierra (10.12) unable to run tests

Created on 30 Oct 2016  路  7Comments  路  Source: facebook/create-react-app

After upgrading to sierra I've got the following error being thrown each time I run npm test

Determining test suites to run...

2016-10-30 15:28 node[763] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-10-30 15:28 node[763] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-10-30 15:28 node[763] (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:1026:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1406:11)
npm ERR! Test failed.  See above for more details.

So far unable to find any fixes, anyone?

Environment

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

  1. npm ls react-scripts (if you haven鈥檛 ejected): [email protected]
  2. node -v: v6.9.1
  3. npm -v: 3.10.8

Most helpful comment

It would be great if you could spend some time debugging what happens without watchman. Many people had and keep having this issue but nobody helped investigate it so far.

All 7 comments

I'm not sure if this helps, but can you try running npm rebuild in your project to rebuild the native addons in your dependencies? When I start seeing weird errors from fsevents and other native dependencies after an OS or Node upgrade, it's usually because of this.

@fson thanks for the tip, unfortunately this does not solve the issue...
I found the following link however following also doesn't fix it :(

# check open file limit
sysctl kern.maxfiles

# edit sysctl
sudo vim /etc/sysctl.conf

# add these two lines
kern.maxfiles=10485760
kern.maxfilesperproc=1048576

# reboot
sudo reboot

# check new file limit
sysctl kern.maxfiles

EDIT: just found that installing watchman fixes an issue, from https://github.com/facebook/jest/issues/1767

It would be great if you could spend some time debugging what happens without watchman. Many people had and keep having this issue but nobody helped investigate it so far.

I got this exact issue as well.
I am on [email protected], node v6.8.0, & npm v3.10.8.

I will try to do some investigation about this without relying on watchman.
Thanks.

Following steps in https://github.com/facebook/react-native/issues/9309#issuecomment-238966924 fixed the issue for me - after editing sysctl.conf, reboot _and_ brew install watchman.

Closing in favor of #713. Let's keep sharing solutions there.

I don't have watchman. Some comment in related issues suggested the problem is caused by the dependencies when your app grows larger. I tried this:

  1. Remove node_modules folder
  2. Clear npm cache. I'm using 3.10.10: npm cache clean
  3. Install dependencies again npm install

It works for me.

Was this page helpful?
0 / 5 - 0 ratings