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: fsEvents is not a function (using Jest and create-react-app)

See original GitHub issue

I keep getting an error “fsEvents is not a function” when I run npm test

Fragment in package.json

"test": "react-scripts test" Error upon running npm test

TypeError: fsevents is not a function
    at new FSEventsWatcher (node_modules/jest-runtime/node_modules/jest-haste-map/build/lib/FSEventsWatcher.js:162:20)
    at createWatcher (node_modules/jest-runtime/node_modules/jest-haste-map/build/index.js:1052:23)
    at Array.map (<anonymous>)
    at HasteMap._watch (node_modules/jest-runtime/node_modules/jest-haste-map/build/index.js:1230:44)
    at node_modules/jest-runtime/node_modules/jest-haste-map/build/index.js:517:21
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (node_modules/jest-runtime/node_modules/jest-haste-map/build/index.js:193:24)
    at _next (node_modules/jest-runtime/node_modules/jest-haste-map/build/index.js:213:9)

React scripts version: 3.0.1 (also tried 3.4.0) Node version: v12.16.1 npm version: 4.6.1

I have tried changing the version of Node (downgrading, upgrading to latest) - doesn’t work, also downgraded npm to 4.x per another post’s recommendation - doesn’t work. Also tried installing the latest version of Chokidar (which I don’t otherwise require as a dependency in the project).

What could be the issue?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:11
  • Comments:13

github_iconTop GitHub Comments

23reactions
phucanhaprilcommented, Mar 31, 2020

i ran brew install watchman and that fixed it for me. not sure if it’s because i’m using fish and fish-nvm or because i just set up a new laptop on apple’s new os catalina.

still using npm, we can’t switch to yarn atm

9reactions
scinkcommented, Mar 20, 2020

i have the same type error. old advices to remove node_modules and yarn.lock or install fsevents do not work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReactJS Test - fsevents is not a function
fsevents is installed by default with npm on Mac OS and Windows operating systems. The error ...
Read more >
fsevents
Start using fsevents in your project by running `npm i fsevents`. There are 4266 other projects in the npm registry using fsevents.
Read more >
jest-haste-map fsevents is not a function, fsevents is not a ...
info fsevents@1.2.11: The platform "linux" is incompatible with this module. ... Doing an npm install -g create-react-app isn't really a solution per se, ......
Read more >
Testing Asynchronous React - Turing: Front-End Curriculum
Run the test suite given by create-react-app to make sure it works: ... getting the error TypeError: MutationObserver is not a constructor while...
Read more >
Error: error:0308010C:digital envelope routines::unsupported
I am facing this error while deploying my react application ... fsevents 1 will break on node v14+ and could be using insecure...
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