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.

v3.0.0 with Node v12/NPM 6.9.0 gives "TypeError: fsevents is not a constructor"

See original GitHub issue

Is this a bug report?

Yes

Did you try recovering your dependencies?

Yes, tried clean install use Node v12 and NPM 6.9.0

Which terms did you search for in User Guide?

Anything about fsevents errors.

Environment

System: OS: macOS 10.14.4 CPU: x64 Intel® Core™ i7-4960HQ CPU @ 2.60GHz Binaries: Node: 12.0.0 - /usr/local/bin/node Yarn: 1.15.2 - ~/.npm-global/bin/yarn npm: 6.9.0 - ~/.npm-global/bin/npm Browsers: Chrome: 73.0.3683.103 Safari: 12.1 npmPackages: react: ^16.8.6 => 16.8.6 react-dom: ^16.8.6 => 16.8.6 react-scripts: 3.0.0 => 3.0.0 npmGlobalPackages: create-react-app: 2.1.8

Don’t know why it says create-react-app: 2.1.8, if I do npm show create-react-app version it echos 3.0.0.

Steps to Reproduce

Install with NPM 6.9.0

Expected Behavior

npm start starts the server

Actual Behavior

fsevents throws:

/Users/.../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/.../Projects/fileflow/app/node_modules/chokidar/lib/fsevents-handler.js:28:11)
    at setFSEventsListener (/Users/.../Projects/fileflow/app/node_modules/chokidar/lib/fsevents-handler.js:82:16)
    at FSWatcher.FsEventsHandler._watchWithFsEvents (/Users/.../Projects/fileflow/app/node_modules/chokidar/lib/fsevents-handler.js:252:16)
    at FSWatcher.<anonymous> (/Users/.../Projects/fileflow/app/node_modules/chokidar/lib/fsevents-handler.js:386:25)
    at LOOP (fs.js:1622:14)
    at processTicksAndRejections (internal/process/task_queues.js:81:9)

Because even though chockidar depends on fsevents 1.2.8, it doesn’t get installed, possibly due to chockidar declaring it as an optional dependency: https://github.com/paulmillr/chokidar/blob/master/package.json#L24

Screenshot 2019-04-24 at 22 20 03

Instead fsevents v2 gets installed which has a different API which exports a plain object (new keyword breaks on it).

⚠️ Works using yarn. (and older NPM versions as it worked on Node v11 I was using yesterday)

Reproducible Demo

Do create-create-app using NPM 6.9.0 and try to run it.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:22
  • Comments:55 (3 by maintainers)

github_iconTop GitHub Comments

46reactions
alan345commented, May 23, 2019
rm -rf node_modules
rm -f yarn.lock 
yarn

Solve the issue

45reactions
DominicTobiascommented, Apr 25, 2019

For now you can downgrade Node, or remove node_modules and package-lock.json and do yarn install instead. Author of chokidar package said it will be fixed in upcoming v3.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix "TypeError: fsevents is not a constructor" react error
below steps solved issue : step 1 : removing node_module and yarn.lock; step 2 : yarn install; step 3 : yarn start.
Read more >
create-react-app v3 문제 - Notion
v3.0.0 with Node v12/NPM 6.9.0 gives "TypeError: fsevents is not a constructor" · Issue #6891 · facebook/create-react-app.
Read more >
typeerror: socksproxyagent is not a constructor - You.com
facebook/create-react-appv3.0.0 with Node v12/NPM 6.9.0 gives "TypeError: fsevents is not a constructor"#6891. Created over 3 years ago.
Read more >
TypeError: fsevents is not a constructor : r/ionic - Reddit
I decided to try this Ionic course to see what it's about. Hardware: Mac Mojave 10.14.6. NPM: 6.9.0. Node: 10.16. Angular: 8.1.3. Ionic:...
Read more >
Electron V10.1.1 Gives Uncaught Typeerror - ADocLib
... Cannot read property 'getBoundingClientRect' of null create react app v3.0.0 with Node v12/NPM 6.9.0 gives "TypeError: fsevents is not a constructor".
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