ReactJS Test - fsevents is not a function ReactJS Test - fsevents is not a function reactjs reactjs

ReactJS Test - fsevents is not a function


Had similar issue on OSX. If you have Homebrew, just run following command in terminal and try again:

brew install watchman 

If it doesn't help, try running following commands in terminal:

sudo rm -rf (xcode-select -print-path)xcode-select --install


Any time I did create-react-app, I got this exact error when I immediately ran 'npm test'. This worked for me if I already was committed to the React project:

npm install fsevents@1.2.11

After some digging, I found out that I needed to manually install this package because CRA pumped out several

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 ...

messages during the initial install. And yet, I needed this package to run 'npm test'.

However, my bigger issue was that CRA was skipping this dependency install because it wasn't detecting xcode on my system. I was getting these messages:

gyp: No Xcode or CLT version detected!

The solution is to run the command

xcode-select --install

Now, any future create-react-app's should operate smoothly without needing any additional dependency installs! Additional Xcode troubleshooting here.


I had the same issue after a fresh install of node and create-react-app. After some searching I found this article [1] about a known issue with running npm test.

After installing watchman, tests are running.

[1] https://github.com/bbc/simorgh/wiki/Known-setup-issue-when-running-%60npm-test%60