Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "TypeError: fsevents is not a constructor" react error

Tags:

While staring React app using npm start this error occurred...

I tried below things:

  1. remove node_module package and reinstall

  2. use yarn instead npm

3.update fsevent library using npm

still getting this error

Note: If we create react app fresh/new yarn start will work, but we close the terminal and restart using same thing below error occurred

/Users/nannam/test-app-2/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/nannam/test-app-2/node_modules/chokidar/lib/fsevents-handler.js:28:11) at setFSEventsListener (/Users/nannam/test-app-2/node_modules/chokidar/lib/fsevents-handler.js:82:16) at FSWatcher.FsEventsHandler._watchWithFsEvents (/Users/nannam/test-app-2/node_modules/chokidar/lib/fsevents-handler.js:252:16) at FSWatcher. (/Users/nannam/test-app-2/node_modules/chokidar/lib/fsevents-handler.js:386:25) at LOOP (fs.js:1565:14) at process._tickCallback (internal/process/next_tick.js:61:11) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

like image 572
Nandkumar Avatar asked May 09 '19 10:05

Nandkumar


2 Answers

npm audit fix --force 

It worked in my case

like image 127
zyMacro Avatar answered Sep 28 '22 03:09

zyMacro


below steps solved issue :

  • step 1 : removing node_module and yarn.lock
  • step 2 : yarn install
  • step 3 : yarn start

enter image description here

like image 32
Saurabh Mistry Avatar answered Sep 28 '22 02:09

Saurabh Mistry