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

macOS fsevents unavailable (this watcher can only be used on Darwin) #423

Open
Glutnix opened this issue Feb 6, 2019 · 39 comments
Open

Comments

@Glutnix
Copy link

Glutnix commented Feb 6, 2019

Environment

  1. code -v : 1.31.0 7c66f58312b48ed8ca4e387ebd9ffe9605332caa x64

  2. node -v: 10.15.1

  3. npm -v: 6.7.0

  4. npm ls jest or npm ls react-scripts (if you haven’t ejected): [email protected]

  5. your vscode-jest settings if customized:

    • jest.pathToJest? blank
    • jest.pathToConfig? blank
    • was working before upgrading VScode to 1.31.0
  6. Operating system: macOS 10.14.3

Prerequisite

  • are you able to run jest test from command line? yes
  • how do you run your tests from command line? (for example: npm run test or node_modules/.bin/jest):
    • npm run test, which is just a shortcut to jest .

Steps to Reproduce

  1. Have Jest Extension installed into older VSCode
  2. Upgrade VSCode to 1.31.1
  3. Open a test/spec file

Relevant Debug Info

Error: `fsevents` unavailable (this watcher can only be used on Darwin)
    at new FSEventsWatcher (/Users/btaylor/Sites/nzta-seatbelts/node_modules/sane/src/fsevents_watcher.js:37:13)
    at createWatcher (/Users/btaylor/Sites/nzta-seatbelts/node_modules/jest-haste-map/build/index.js:952:23)
    at Array.map (<anonymous>)
    at HasteMap._watch (/Users/btaylor/Sites/nzta-seatbelts/node_modules/jest-haste-map/build/index.js:1127:44)
    at _buildPromise._buildFileMap.then.then.hasteMap (/Users/btaylor/Sites/nzta-seatbelts/node_modules/jest-haste-map/build/index.js:441:23)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)

Error: `fsevents` unavailable (this watcher can only be used on Darwin)
    at new FSEventsWatcher (/Users/btaylor/Sites/nzta-seatbelts/node_modules/sane/src/fsevents_watcher.js:37:13)
    at createWatcher (/Users/btaylor/Sites/nzta-seatbelts/node_modules/jest-haste-map/build/index.js:952:23)
    at Array.map (<anonymous>)
    at HasteMap._watch (/Users/btaylor/Sites/nzta-seatbelts/node_modules/jest-haste-map/build/index.js:1127:44)
    at _buildPromise._buildFileMap.then.then.hasteMap (/Users/btaylor/Sites/nzta-seatbelts/node_modules/jest-haste-map/build/index.js:441:23)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)

Error: `fsevents` unavailable (this watcher can only be used on Darwin)
    at new FSEventsWatcher (/Users/btaylor/Sites/nzta-seatbelts/node_modules/sane/src/fsevents_watcher.js:37:13)
    at createWatcher (/Users/btaylor/Sites/nzta-seatbelts/node_modules/jest-haste-map/build/index.js:952:23)
    at Array.map (<anonymous>)
    at HasteMap._watch (/Users/btaylor/Sites/nzta-seatbelts/node_modules/jest-haste-map/build/index.js:1127:44)
    at _buildPromise._buildFileMap.then.then.hasteMap (/Users/btaylor/Sites/nzta-seatbelts/node_modules/jest-haste-map/build/index.js:441:23)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)

Error: `fsevents` unavailable (this watcher can only be used on Darwin)
    at new FSEventsWatcher (/Users/btaylor/Sites/nzta-seatbelts/node_modules/sane/src/fsevents_watcher.js:37:13)
    at createWatcher (/Users/btaylor/Sites/nzta-seatbelts/node_modules/jest-haste-map/build/index.js:952:23)
    at Array.map (<anonymous>)
    at HasteMap._watch (/Users/btaylor/Sites/nzta-seatbelts/node_modules/jest-haste-map/build/index.js:1127:44)
    at _buildPromise._buildFileMap.then.then.hasteMap (/Users/btaylor/Sites/nzta-seatbelts/node_modules/jest-haste-map/build/index.js:441:23)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)

Error: `fsevents` unavailable (this watcher can only be used on Darwin)
    at new FSEventsWatcher (/Users/btaylor/Sites/nzta-seatbelts/node_modules/sane/src/fsevents_watcher.js:37:13)
    at createWatcher (/Users/btaylor/Sites/nzta-seatbelts/node_modules/jest-haste-map/build/index.js:952:23)
    at Array.map (<anonymous>)
    at HasteMap._watch (/Users/btaylor/Sites/nzta-seatbelts/node_modules/jest-haste-map/build/index.js:1127:44)
    at _buildPromise._buildFileMap.then.then.hasteMap (/Users/btaylor/Sites/nzta-seatbelts/node_modules/jest-haste-map/build/index.js:441:23)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)

Starting Jest in Watch mode failed too many times and has been stopped.
 see troubleshooting: https://github.com/jest-community/vscode-jest/blob/master/README.md#troubleshooting

Expected Behavior

Watch mode to work as expected

Actual Behavior

A notification is shown "Starting Jest in Watch mode failed too many times and has been stopped." and the Jest extension output window is shown with the debug info above.

@GargantulaKon
Copy link

It happens in version 1.31.0 as well. I see that you have 1.31.1 listed. Is that the Insiders version?

@Glutnix
Copy link
Author

Glutnix commented Feb 8, 2019 via email

@EdouardBougon
Copy link

brew install watchman fixed the problem for me.

cm-pliser-tdd-by-example/tdd-by-example-js#10 (comment)

@Glutnix
Copy link
Author

Glutnix commented Feb 12, 2019

I had watchman already installed. I did a full brew reinstall watchman and still no dice.

@GargantulaKon
Copy link

@EdouardBougon Those instructions worked for me, thanks!

@Glutnix
Copy link
Author

Glutnix commented Feb 20, 2019

Figured it out. I didn't realise that Nuxt was putting a jest config into package.json, and for some reason, I had "watchman": false in there.. sigh 😑

@JohnGeorgiadis
Copy link

brew install watchman worked for me too, thanks!

@LuizFellype
Copy link

I was facing this problem with version of node in 11.15.0, then I changed to v10.15.3 and its gone.

@elhachmi
Copy link

elhachmi commented Jun 22, 2019

I'm using jest with react native, every things goes well before I restarted my machine, then I got the same error. Installing watchman didn't solve my problem, I stoped Metro Bundler I deleted build folder from android project I relaunchced my app and it works again.

@lexyblazy
Copy link

brew install watchman worked for me as well. Thanks.

@TheHolisticDev
Copy link

TheHolisticDev commented Aug 13, 2019

npm install -g fsevents worked for me.

@ayunas
Copy link

ayunas commented Aug 18, 2019

npm install fsevents fixed my issue as well. This is on a fresh install of mac osx

@philippefutureboy
Copy link

npm install -g fsevents did not work for me
npm install fsevents worked for me, optionally with -D flag

@anthony-alfaro
Copy link

brew install watchman worked!!! Thanks.

@vladminsky
Copy link

vladminsky commented Sep 26, 2019

Nothing helped until...

brew reinstall watchman fixed the problem on node v12.10.0

@episage
Copy link

episage commented Sep 28, 2019

brew reinstall watchman works for macOS Mojave, node v12.10.0

@liam-mei
Copy link

brew install watchman didn't work for me.

npm install --save-dev fsevents worked for me
macOs: Mojave,
node: 12.6.0

@netdesignr
Copy link

netdesignr commented Nov 11, 2019

brew install watchman it might work if there's no instance of watchman. In my situation, I had to
brew upgrade watchman and it worked like a charm.

macOs: Catalina
node: 12.12.0

@LitoMore
Copy link

But why? Anyone can explain why we have to run brew install watchman?

@Billson7
Copy link

nvm use then yarn:test worked for me. Turns out it was the wrong version of node.

@sirvan3tr
Copy link

brew upgrade watchman worked for me as I already had it installed.

@jamesalley
Copy link

brew install watchman worked for me.

@LitoMore
Copy link

You guys should look for the reasons, not just brew install watchman.

There is no documentation says we need install watchman. So why?

@fahadhaq
Copy link

fahadhaq commented Mar 8, 2020

For me I tried all of the above but nothing worked. I had to set the correct nap version. for me I used the following command as I use nvm and have several version of nom installed.

nvm alias default 10.6.0

Hope this will help someone out there.

@6220119
Copy link

6220119 commented Apr 28, 2020

@LitoMore The reason being:
https://github.com/facebook/jest/blob/ac267b16e46527d16945fe468f436e46c694fe73/packages/jest-haste-map/src/index.ts#L801

Jest Haste Map has a dependencies on SaneWatcher which can use FB Watchman over fs

// WatchmanWatcher > FSEventsWatcher > sane.NodeWatcher

@LitoMore
Copy link

@6220119 Thank you so much my Grabber! 🤝

@mrmgomes
Copy link

brew install watchman didn't work for me.

npm install --save-dev fsevents worked for me
macOs: Mojave,
node: 12.6.0

npm install --save-dev fsevents solved the problem. Thanks!

@Ridd0
Copy link

Ridd0 commented Jun 30, 2020

Run yarn install again worked for me.

@partriv
Copy link

partriv commented Jul 7, 2020

brew upgrade watchman worked for me. I already had watchman installed, but upgraded from node 8 to node 10 and encountered this error.

@swiss-chris
Copy link

In my case all I needed was npm install :)

@iamsaurabhrai
Copy link

brew reinstall watchman works for me too on macOS Catalina, node v12.8.1

@kelly-tock
Copy link

brew upgrade watchman worked for me no node v13.13.0, as I already had it installed.

@kenning
Copy link

kenning commented Aug 5, 2020

the fsevents and node-gyp packages have caused me issues for years, and it seems like nobody understands what actually causes this. i'm on mac os 10.15 but since mac os ~10.12 in like 2017 it's thrown random errors and occasionally messed up npm installs just enough so that i have learned to try random crap until it sort of works without actually figuring it out.

here's some things which have seemed to be related:

  • messed up python 2 or pip install -- sometimes this is helped by installing python 3.7 or 3.8 and aliasing python to python 3
  • npm install -g node-gyp or npm install -g fsevents
  • using npm instead of yarn or vice versa; deleting node_modules and reinstalling; deleting package-lock or yarn.lock and using the other one; etc.
  • installing or reinstalling xcode command line tools, so that random .h files (frei0r.h is one of three which come up sometimes) which are in /usr/local/include get included by the clang++ compiler

i've shown these issues to people much smarter than me and nobody seems to be able to diagnose the problem. the fact that it sprawls between node, python and even c++ makes me think i'm just not going to figure this out and should just reinstall (although i haven't actually had to yet).

i still have no clue what the central issue is, and whenever i google for related issues i just see threads like this with dozens of people saying "well i tried this and it worked i guess," and eventually, replies like "that didnt work for me." and many of them still get replies, like this one -- the last reply was just 8 days ago.

if the above suggestions don't work, reader, i wish i could help you.

edit: i've seen "try installing or reinstalling watchman" many times and although it clearly works for a lot of people, it's one of the few suggestions that has never improved things for me.

edit 2: i switched to ubuntu because i like laptops with usb and hdmi ports. got a thinkpad and it installed in 15 minutes and i've actually had zero problems, never going back.

@pawanraocse
Copy link

brew install watchman, this works!!

@gitpancake
Copy link

brew install watchman fixed the problem for me.

cm-pliser-tdd-by-example/tdd-by-example-js#10 (comment)

This worked for me!! brew install watchman, then when running the test suite again I needed to grant some permissions to watchman.

@Sayvai
Copy link

Sayvai commented Jan 20, 2021

brew install watchman worked for me also.

However, i stumbled across a non-related issue to do with excessive node process CPU usage when idle (~250%), and so i downloaded and re-installed Command Line Tools for Xcode, and then restarted my machine (that's important), which appears to resolve the excessive node CPU usage issue, and by coincidence it looks to have also resolved the Jest Watch mode issue too, without the need for the brew dependency; watchman after i carried out a Jest Watch mode test run after uninstalling the dependency; brew uninstall watchman.

Not sure specifically why this approach to reinstalling Command Line Tools for Xcode works to resolve the Jest Watch mode issue as described on this ticket, which i had also suffered from.

But this may provide an alternative approach for others who may like to avoid installing additional dependencies such as watchman, where possible, to workaround the Jest Watch mode issue.

@homostellaris
Copy link

homostellaris commented Mar 18, 2021

I was using Node 15 but the project was created in the Node 8 days. Fix for me was:

- nvm install 8
- rm -rf node_modules/
- npm install

This is why all projects should have an .nvmrc.

@vvvprabhakar
Copy link

brew install watchman didn't work for me.

npm install --save-dev fsevents worked for me

macos: Big Sur
Node version : 12

@347830076
Copy link

使用这个命令安装就好了 npm install --save-dev fsevents

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