升级macOS Sierra系统之后出现了很多问题,跟FB的reactnative环境也出现了冲突问题,导致reactnative项目不能运行,报错如下:
[11:45:02 AM] <START> Building Dependency Graph
[11:45:02 AM] <START> Crawling File System
[Hot Module Replacement] Server listening on /hot
React packager ready.
2016-09-23 11:45 node[6397] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-23 11:45 node[6397] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-23 11:45 node[6397] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
ERROR watch null EMFILE
{"code":"EMFILE","errno":"EMFILE","syscall":"watch null","filename":null}
Error: watch null EMFILE
at exports._errnoException (util.js:873:11)
at FSEvent.FSWatcher._handle.onchange (fs.js:1217:21)
PS:这是部分用户升级遇到的问题,有的电脑升级就没有这个问题
楼主各种寻找答案,最终在谷歌上找到了解决办法,先贴出链接。
问题的根源:是升级系统之后watchman没有及时的支持最新版本的mac系统10.12,所以解决办法是写在后重新安装watchman,使其适配最新版本的mac系统。
解决办法:
$ cd /Desktop
$ git clone https://github.com/facebook/watchman.git
$ cd watchman
$ git checkout v4.7.0 # the latest stable release
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
之后执行
watchman version
或者watchman -v
你就会得到如下结果
{
"version": "4.7.0"
}```
如果以上都不行的话,重新安装homebrew,然后执行
brew install watchman
之后再运行你的RN程序就可以完美运行了。OK ,have fun !