question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in jest watch when using yarn for dependency installation

See original GitHub issue

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:

  1. npm ls react-scripts: react-scripts@0.8.5
  2. node -v: v7.4.0
  3. npm -v: 4.1.2

Then, specify:

  1. 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

  2. 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.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:20 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
tsironiscommented, Feb 20, 2017

I fixed the issue upgrading yarn to v0.20.1 and then brew install watchman. Apparently, there is a problem watching file changes in macOS Sierra.

1reaction
aztecrexcommented, 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

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix dependency error with React App using Jest
json file in your project folder; Run npm install or yarn, depending on the package manager you use.
Read more >
jest-watch-typeahead | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
Jest CLI Options
The jest command line runner has a number of useful options. You can run jest --help to view all available options. Many of...
Read more >
ts-jest - npm
A Jest transformer with source map support that lets you use Jest to test projects written in TypeScript. Latest version: 29.0.3, ...
Read more >
A guide through The Wild Wild West of setting up a mono repo ...
We will be using TypeScript, Yarn workspaces, Lerna, and Jest. ... Now that all the dependencies are installed, let's continue with the Lerna.json ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found