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.

npm test dies with exception

See original GitHub issue

Is this a bug report?

Yes

Can you also reproduce the problem with npm 4.x?

Yes.

Which terms did you search for in User Guide?

npm test

It is not the same as the problem described under npm test hangs on macOS Sierra.

Environment

  1. node -v: v7.9.0
  2. npm -v: 4.2.0
  3. yarn --version (if you use Yarn):
  4. npm ls react-scripts (if you haven’t ejected): └── react-scripts@1.0.11

Then, specify:

  1. Operating system: macOS Sierra 10.12.6
  2. Browser and version (if relevant): Not relevant

I do not have watchman installed.

Steps to Reproduce

  1. create-react-app foo
  2. cd foo
  3. npm test

Expected Behavior

I expect the tests to run.

Actual Behavior

Output is:

 RUNS  src/App.test.js
2017-08-25 10:01 node[90950] (FSEvents.framework) FSEventStreamStart: register_w
 RUNS  src/App.test.js
2017-08-25 10:01 node[90950] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
events.js:163
      throw er; // Unhandled 'error' event
      ^

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

Reproducible Demo

See above steps to reproduce.

Workaround

Downgrading to “react-scripts”: “1.0.10” fixes the problem.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
amaidahcommented, Nov 11, 2017

Was having same error on yarn test using:

node v8.9.0 yarn v0.20.3 MacOS Sierra 10.12.6

Same error after deleting /node_modules and re-installing using yarn install

Followed these instructions from readme to get yarn test working again:

watchman shutdown-server
brew update
brew reinstall watchman

I’m curious if this means that someone cloning my repo and trying to run tests will also need to have watchman installed?

1reaction
mackbrownecommented, Nov 25, 2017

Also having this problem. Was developing at work, tried to at home and it’s broken now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to test of throwing exception in nodejs using mocha
Here is mocha test: it('throw error, input for engineAction', function(done) { var gm = new GM (); expect(gm.engineAction.
Read more >
Uncaught Exceptions in Node.js - George Ornbo
Dealing with uncaught exceptions in Node.js is not straightforward.
Read more >
Let It Crash: Best Practices for Handling Node.js Errors on ...
When a JavaScript error is not properly handled, an uncaughtException is emitted. These suggest the programmer has made an error, and they ...
Read more >
Node.js Error Handling Best Practices: Ship With Confidence
When JavaScript finds a throw keyword, the first thing it does is stop dead in its tracks. This event prevents any more functions...
Read more >
The Death of a Node.js Process - Thomas Hunter II
Unlike with an uncaught exception, these rejections won't crash a process as of Node.js v14. In future versions of Node.js this will crash...
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