create-react-app: Error in jest watch when using yarn for dependency installation
If you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely.
Can you reproduce the problem with latest npm?
Can you still reproduce it?
Yes.
Description
npm test
, yarnpkg test
, yarn test
all fail when dependencies are installed with
yarn install
. They all work fine when dependencies are installed with npm install
.
In CI mode (not watched), tests run fine after installing deps with yarn. Research indicates others are having similar problems with tools like Watchman which leads me to believe that something is different in how Jest is performing the watch depending on how it is installed. There is also a sense that this has to do with OSX Sierra.
Expected behavior
Tests run
Actual behavior
Crash. See stack trace beow.
Environment
Run these commands in the project folder and fill in their results:
npm ls react-scripts
: react-scripts@0.8.5node -v
: v7.4.0npm -v
: 4.1.2
Then, specify:
-
Operating system: Darwin trefoil 16.3.0 Darwin Kernel Version 16.3.0: Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64
-
Browser and version: Not a browser isssue
Reproducible Demo
Easy: this happens from a fresh create-react-app when Yarn (freshly brewed today)
is installed. yarnpkg test
will fail. Now delete node_modules and run
npm install
now npm test
works fine. delete node_modues and run
yarn install
, bad behavior returns.
Push to GitHub and paste the link here.
https://github.com/aztecrex/demo-create-react-app-yarn-problem
Full stack trace:
2017-01-30 18:58 node[77220] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-01-30 18:58 node[77220] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-01-30 18:58 node[77220] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-01-30 18:58 node[77220] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-01-30 18:58 node[77220] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-01-30 18:58 node[77220] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-01-30 18:58 node[77220] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-01-30 18:58 node[77220] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-01-30 18:58 node[77220] (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:1022:11)
at FSEvent.FSWatcher._handle.onchange (fs.js:1283:11)
error Command failed with exit code 1.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 20 (10 by maintainers)
I fixed the issue upgrading yarn to
v0.20.1
and thenbrew install watchman
. Apparently, there is a problem watching file changes in macOS Sierra.Removed those dirs and the “install watchman” workaround fixes the problem. Uninstalling watchman causes it to re-occur.
@hongrich glad I tried it again