vscode-jest icon indicating copy to clipboard operation
vscode-jest copied to clipboard

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

Open Glutnix opened this issue 6 years ago • 39 comments

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.

Glutnix avatar Feb 06 '19 21:02 Glutnix

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

GargantulaKon avatar Feb 08 '19 13:02 GargantulaKon

No, 1.31.1 was just the latest vscode release

Glutnix avatar Feb 08 '19 19:02 Glutnix

brew install watchman fixed the problem for me.

https://github.com/cm-pliser-tdd-by-example/tdd-by-example-js/issues/10#issuecomment-361039205

EdouardBougon avatar Feb 11 '19 09:02 EdouardBougon

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

Glutnix avatar Feb 12 '19 23:02 Glutnix

@EdouardBougon Those instructions worked for me, thanks!

GargantulaKon avatar Feb 13 '19 20:02 GargantulaKon

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 😑

Glutnix avatar Feb 20 '19 02:02 Glutnix

brew install watchman worked for me too, thanks!

JohnGeorgiadis avatar Jun 04 '19 08:06 JohnGeorgiadis

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

LuizFellype avatar Jun 07 '19 19:06 LuizFellype

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.

elhachmi avatar Jun 22 '19 10:06 elhachmi

brew install watchman worked for me as well. Thanks.

lexyblazy avatar Aug 07 '19 19:08 lexyblazy

npm install -g fsevents worked for me.

TheHolisticDev avatar Aug 13 '19 15:08 TheHolisticDev

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

ayunas avatar Aug 18 '19 16:08 ayunas

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

philippefutureboy avatar Sep 05 '19 18:09 philippefutureboy

brew install watchman worked!!! Thanks.

anthony-alfaro avatar Sep 18 '19 15:09 anthony-alfaro

Nothing helped until...

brew reinstall watchman fixed the problem on node v12.10.0

vladminsky avatar Sep 26 '19 13:09 vladminsky

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

episage avatar Sep 28 '19 10:09 episage

brew install watchman didn't work for me.

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

liam-mei avatar Oct 31 '19 02:10 liam-mei

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

netdesignr avatar Nov 11 '19 15:11 netdesignr

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

LitoMore avatar Nov 15 '19 07:11 LitoMore

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

Billson7 avatar Jan 17 '20 11:01 Billson7

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

sirvan3tr avatar Feb 15 '20 20:02 sirvan3tr

brew install watchman worked for me.

jamesalley avatar Feb 19 '20 01:02 jamesalley

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

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

LitoMore avatar Feb 19 '20 02:02 LitoMore

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.

fahadhaq avatar Mar 08 '20 04:03 fahadhaq

@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

6220119 avatar Apr 28 '20 03:04 6220119

@6220119 Thank you so much my Grabber! 🤝

LitoMore avatar Apr 28 '20 09:04 LitoMore

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!

mrmgomes avatar May 16 '20 18:05 mrmgomes

Run yarn install again worked for me.

Ridd0 avatar Jun 30 '20 08:06 Ridd0

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

partriv avatar Jul 07 '20 02:07 partriv

In my case all I needed was npm install :)

swiss-chris avatar Jul 16 '20 10:07 swiss-chris