-
-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Description
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.
Activity
gaearon commentedon Jan 31, 2017
Can you check if
node_modules/fsevents
exists after installing with either Yarn or npm?robertlyall commentedon Jan 31, 2017
I'm having the same problem with version 1.0.3.
fsevents
existed in mynode_modules
directory after installing withnpm install
,yarn install
andyarnpkg install
, however I could only run tests after installing withnpm
.gaearon commentedon Jan 31, 2017
Which version of Yarn are you using?
robertlyall commentedon Jan 31, 2017
I'm using Yarn version 0.19.1.
gaearon commentedon Jan 31, 2017
Could this be a regression? Would you mind installing 0.18 and trying again?
robertlyall commentedon Jan 31, 2017
Experiencing the same problem with 0.18.0, 0.18.1 and 0.20.0.
It may be worth noting that I'm using Yarn installed globally via NPM. I can try again using Homebrew if you'd like?
aztecrex commentedon Jan 31, 2017
The one giving me trouble is 0.19.1 installed via Homebrew. That was my first version so can't
brew switch
gaearon commentedon Jan 31, 2017
Can you figure out what the difference between installs produced by Yarn and npm is? Is some package or binary missing?
robertlyall commentedon Jan 31, 2017
I'm not sure what's the best way to do that. Do you have any suggestions?
I ran
npm ls
afteryarn install
and saw the following error:npm start
does not show the same error. I don't know whether this error is important or not.hongrich commentedon Jan 31, 2017
Is this the same as #871? Maybe try installing
watchman
?aztecrex commentedon Jan 31, 2017
i just pushed the repo with both node_modules and a diff, https://github.com/aztecrex/demo-create-react-app-yarn-problem. Interesting, here is the result of
du -sh *
(
node_modules_diff
is just the text output ofdiff -r node_modules.*
)aztecrex commentedon Jan 31, 2017
@hongrich i had tried that yesterday. I just tried it again: install watchman, delete node_modules,
yarn install
. I get many warnings before jest gives me the watch UI, for example:When i press
a
, It runs and fails a bunch of tests I don't have (this is just a newly-created CRA so it should have just one), for example,After I uninstall watchman, the behavior goes back to the one described in this report.
gaearon commentedon Jan 31, 2017
This is because of those
node_modules.npm
andnode_modules.yarn
folders which conflict. I wonder if there’s a way to disable Haste completely in open source with some config option, cc @cpojer? It’s not really useful to CRA users.aztecrex commentedon Jan 31, 2017
Removed those dirs and the "install watchman" workaround fixes the problem. Uninstalling watchman causes it to re-occur.
@hongrich glad I tried it again
cpojer commentedon Feb 1, 2017
@gaearon yeah we are making some changes that should improve this situation.
gaearon commentedon Feb 11, 2017
Going to close since this is out of our control.
If you have issues with Yarn please report them, and use npm while they are being fixed.
tsironis commentedon Feb 20, 2017
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.gaearon commentedon Feb 20, 2017
If your tests hang, that's not the problem described in this issue. For that problem, please see here.
tsironis commentedon Feb 24, 2017
Sorry my bad! I didn't describe this correctly, I meant FSWatcher is not longer available in macOS Sierra so watchman is required.
bholtbholt commentedon Mar 24, 2018
I hit this issue today on macOS High Sierra using Yarn. Deleting my
node_modules
and rerunningyarn
fixed it for me.