Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: fsevents.watch is not a function #1180

Closed
DerekSeverson opened this issue Dec 2, 2021 · 3 comments
Closed

TypeError: fsevents.watch is not a function #1180

DerekSeverson opened this issue Dec 2, 2021 · 3 comments

Comments

@DerekSeverson
Copy link

DerekSeverson commented Dec 2, 2021

Describe the bug

When running webpack serve --open using webpack-dev-server (https://github.com/webpack/webpack-dev-server), chokidar is throwing a TypeError: fsevents.watch is not a function exception.

Here's the full output:

> webpack serve --open

<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: http://localhost:8080/
<i> [webpack-dev-server] On Your Network (IPv4): http://172.21.3.127:8080/
<i> [webpack-dev-server] On Your Network (IPv6): http://[fe80::1]:8080/
<i> [webpack-dev-server] Content not from webpack is served from './dist' directory
/Users/Severson/Projects/react-essentials-with-luna/node_modules/chokidar/lib/fsevents-handler.js:93
  const stop = fsevents.watch(path, callback);
                        ^

TypeError: fsevents.watch is not a function
    at createFSEventsInstance (/Users/Severson/Projects/react-essentials-with-luna/node_modules/chokidar/lib/fsevents-handler.js:93:25)
    at setFSEventsListener (/Users/Severson/Projects/react-essentials-with-luna/node_modules/chokidar/lib/fsevents-handler.js:149:16)
    at FsEventsHandler._watchWithFsEvents (/Users/Severson/Projects/react-essentials-with-luna/node_modules/chokidar/lib/fsevents-handler.js:351:18)
    at FsEventsHandler.initWatch (/Users/Severson/Projects/react-essentials-with-luna/node_modules/chokidar/lib/fsevents-handler.js:427:23)
    at FsEventsHandler._addToFsEvents (/Users/Severson/Projects/react-essentials-with-luna/node_modules/chokidar/lib/fsevents-handler.js:516:12)

Versions (please complete the following information):

  • Chokidar version: 3.5.2
  • Node version 16.13.0
  • OS version: MacOS 11.6 (Big Sur)

To Reproduce:

Using Node.js v16.13, run webpack server --open using webpack-dev-server.

Here's where webpack-dev-server is leveraging chokidar: https://github.com/webpack/webpack-dev-server/blob/d8d5d71c8ca495098e1ee30ebc72ffd657ad5ba0/lib/Server.js#L2233

Expected behavior

chokidar should not call fsevents.watch if it is not a function within the lib/fsevents-handler.js:93code base.

Additional context

I posted this bug initially to webpack-dev-server, and they directed me here. Here's said issue:

webpack/webpack-dev-server#4070

@DerekSeverson
Copy link
Author

Somehow I resolved my issues. (I'll close this issue).

I guess upgrading to webpack@5.64.2 -> 5.64.4 and webpack-dev-server@4.5.0 -> 4.6.0 fixed it.

Thanks.

@mutantcornholio
Copy link

Can we reopen this one? I've got this issue in case where there was fsevents version 1 installed nearby: vitejs/vite#18728

@43081j
Copy link
Collaborator

43081j commented Nov 21, 2024

As far as I understand, it will be solved once vite upgrades chokidar

But I seem to remember them being blocked on that for whatever reason (probably waiting for me 😅)

I'll try chase up on that again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants