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

Hi there,
I’m encoutring an error with Expo xde.
everything was working ok until today. When ’ create a new project and try to start it, an error is swhown with the following description:
"Error: fsevents unavailable (this watcher can only be used on Darwin) ".
I couldn’t find any solution for that.
However all my ald projects are starting normally.

Any Help would be appreciated.
thanks

1 Like

Hi, I’m guessing you’re on Windows (Maybe Linux?)

Are you getting this error in the XDE logs?

HI, I’m on Mac. Yes i’m getting this error in the XDE logs.
hier is the complete error message:

Starting React Native packager…
9:27:58 AM
Scanning 789 folders for symlinks in /Users/Miladi/ReactNative/trans/node_modules (7ms)
9:27:59 AM
9:28:00 AM
Project opened! You can now use the “Share” or “Device” buttons to view your project.
9:28:01 AM
Error: fsevents unavailable (this watcher can only be used on Darwin)

@miladi7 what does uname -a return?

Im facing the same issue…

uname:
Darwin YamadaKaitos-Mac.local 17.2.0 Darwin Kernel Version 17.2.0: Mon Sep 18 15:44:59 PDT 2017; root:xnu-4570.20.55~19/RELEASE_X86_64 x86_64
OS X 10.13.1 Public Beta

Thanks

1 Like

uname -a returns:
Darwin MacBookRetina.local 15.6.0 Darwin Kernel Version 15.6.0: Sun Jun 4 21:43:07 PDT 2017; root:xnu-3248.70.3~1/RELEASE_X86_64 x86_64

@miladi7 @yamadakaito Can you try installing watchman through homebrew?

1 Like

hi thetc,
nothing changed after reinstall watchman.
I can’t execute any new created project, always the same error. Please any solution? i’m stack.

Hmm, have you tried: rm -rf node_modules and reinstalling?
Could you also confirm whether you get the same error with exp start?

1 Like

Something new with this ? I get the exact same error on Mac Sierra.

rm -rf node_modules does not change anything.

Cheers

1 Like

Using yarn in terminal instead of Expo XDE (which appears to use npm) resolved the issue for me.

Did you still use Expo XDE after installing the dependencies with yarn ? Because I’ve deleted the node_modules directory, then I’ve used yarn to install them again. But still Expo throw this error

Building JavaScript bundle
20:53:25
Error: `fsevents` unavailable (this watcher can only be used on Darwin)
    at new FSEventsWatcher (/Users/bondot_e/Workspace/lilo-app/node_modules/sane/src/fsevents_watcher.js:41:11)
    at createWatcher (/Users/bondot_e/Workspace/lilo-app/node_modules/metro-bundler/node_modules/jest-haste-map/build/index.js:590:23)
    at Array.map (native)
    at HasteMap._watch (/Users/bondot_e/Workspace/lilo-app/node_modules/metro-bundler/node_modules/jest-haste-map/build/index.js:737:25)
    at _buildPromise._buildFileMap.then.then.hasteMap (/Users/bondot_e/Workspace/lilo-app/node_modules/metro-bundler/node_modules/jest-haste-map/build/index.js:269:21)
    at process._tickCallback (internal/process/next_tick.js:103:7)

Nope, I have to use yarn start in terminal, not XDE’s UI

Hi,
using the terminal resolve the issue for me too, but how to publish an app to your expo account with the terminal?
However i want to be able to use expo ui, but no chance since the error still exist with expo XDE.

To publish your app from the terminal, use the command exp publish. See the exp project on Github for more info.

As far as using XDE, I don’t have any answers there. It seems XDE wants to use the most recent version of npm, which doesn’t work with Expo at the moment.

XDE and exp both invoke the React Native packager server, which uses the code under node_modules. I recommend reinstalling your node_modules to ensure that fsevents is built if you’re on macOS. You can do this with: rm -fr node_modules && yarn. You also can use npm install (4.x and 5.4.x should both work if you’re not using create-react-native-app) instead of yarn. Then click Restart in XDE and try again.

This worked for me. Thank you.

1 Like

None of the above suggestions worked, however, I did discover that this error can occur and become troublsome to fix when using nvm. The problem occurs when the system version of node is different from the shell version set up with nvm. When this happens actions to fix in one version of node don’t fix the version of node that starts with expo ide (the default system version).

Two things need to happen:

First, make sure that every new shell starts with a consistent version of node.js by putting “nvm use 8.7.0” or whatever version you are currently using. That way all shells and expo start with the same version. Type nvm ls’ to make sure that the ‘system’ alias is the version specified.

Second, fix the problem in the correct version of node.js (make sure the right version of node is being used when fixing things with ‘nvm ls’ or if you use another package manager, make sure the system one is the one you are fixing (in a new shell, check node --version)

Apply these fixes, one of which is probably the issue: (a variation on: How to clear the React Native packager) One or more of the below statements may not be a problem, but this represents the sledge hammer solution. XDE users should follow the npm line of fixes, others can use yarn.

  1. Stop the XDE/exp
  2. Install a version of npm below 5 (as of October 2017). I read it’s unstable… You can experiment with later versions once you get to a stable install. Yarn works great no matter what from what I can tell, but npm is used by expo XDE and it needs to be a stable version for the version of node it boots into. If you create a new project with the XDE, you will have problems if you haven’t updated npm, you will then have to rely on yarn from the command line nonsense once the project is created by the XDE.
      nvm use 8.7.0
      npm install npm@4.6.1 -g
  1. Install the latest watchman, something like: (if you have the latest, then the watchman fixes can probably be skipped)
      watchman shutdown-server
      brew update
      brew reinstall watchman
  1. remove and reinstall node_modules:
      rm -rf node_modules
  1. Clear your Yarn or npm cache, depending on which you’re using, with yarn cache clean or npm cache clean
  2. Run yarn or npm i to install your dependencies again
  3. Run watchman watch-del-all to clear Watchman’s state
  4. Delete the packager’s cache directory with rm -fr $TMPDIR/react-*
  5. Now start the XDE or exp.

Note: For the expo XDE, it supposedly uses npm, so steps 5 and 6 are probably not necessary when using the XDE (expo IDE).

3 Likes

I am trying these commands

rm -fr node_modules && yarn
npm install

but it does not help, can you explain more?

Hi @hazephase, while we are not completely sure about the root cause of this bug, we noticed that the equivalent command to start up your project in terminal will work instead of using the XDE.

To do this, type exp start in the directory where your project is.