chokidar: TypeError: fsevents is not a constructor

Chokidar fails to run due to calling new on fsevents like it’s a class or function but it’s not.

To Reproduce Create an app with create-react-app 3.0.0 and run npm start

Error trace

.../node_modules/chokidar/lib/fsevents-handler.js:28
  return (new fsevents(path)).on('fsevent', callback).start();
          ^

TypeError: fsevents is not a constructor
    at createFSEventsInstance (/Users/infensus/Projects/fileflow/app/node_modules/chokidar/lib/fsevents-handler.js:28:11)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 16
  • Comments: 29 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Solution: rm -rf node_modules package-lock.json yarn.lock and then npm install or yarn install

Ensure you are using chokidar v3 and higher! Chokidar v2 uses fsevents v1, which is deprecated. Note: you will need to use node.js v8.10 or higher for chokidar v3.

Nothing works.

this works for me

rm -rf node_modules
yarn install

If anyone is still experiencing this issue, just read npm install again. This worked for me.

npm install --save --save-exact react-scripts@3.0.1 worked for me

This worked npm install --save --save-exact react-scripts@3.0.1

This is a serious issue…

I do not wish to downgrade my NPM version since I cannot enforce this across the team

This may not be an option for everyone, but it has worked for my purpose.

If you ran npm audit, it will tell you all the unmet dependencies. Look out out for chokidar v2 and fsevent.

You can fix most of these warnings by running npm audit fix. But whichever are still not fixed, can be fixed manually or by running npm audit fix --force

If anyone has still the same issue, uninstall yarn and try with npm, worked for me !

TOTALLY ABSURD… nothing works, tried everything mentioned here, and since April nothing has been done to fix this. I can’t get my simple React program to work !!!

I solved this issue with creating my react app with npx create-react-app app_name

Update I resolved this issue on my end by updating the create-react-app as in the migration instructions here:

https://github.com/facebook/create-react-app/releases/tag/v3.0.1


@paulmillr is there a solution for this. I’m having the same issue on my end.

Choidar 2.0.4 Node: 12.1.0 npm: 6.9.0 OS version: MacOS Mojave 10.14.5 (18F132)