jest --watch (npm t — --watch) throwing errors

2019-07-31 09:34发布

问题:

node[1265] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)

This happens when running npm t -- --watch. On my system node v7.4.0 it works fine. On my fellow coworker (node v7.9) it fails.

This question here asks the exact problem:

Testing with Jest failed with Error: Error watching file for changes: EMFILE


However the fix "install watchman" didn't work.

We did brew install watchman then brew postinstall watchman

Then when trying to run npm t -- --watch again we get a new error:

/Users/user/Library/LaunchAgents/com.github.facebook.watchman.plist: Operation not permitted

Anyone else running into a problem with jest watch?

The regular npm t will work.

回答1:

After installing watchman, you can give it a full permission to the launch agents by sudo chown -R $(whoami):staff ~/Library/LaunchAgents.
It will resolve the permission issue.



回答2:

So we had to install jest-cli with watchman on his computer...