react-native项目启动报错——watchman安装问题,mac pro

启动react-native脚手架和项目后报错:

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

原因分析:没有正确安装react-native依赖watchman

初次安装使用的是

npm i watchman -g

安装完会提示你npm 已经不支持watchman了,下载后的文件夹下只有package.json和readme.md两个文件

所以这种方式安装是不行的

成功安装的方式是使用homebrew包管理工具下载安装watchman

brew install watchman

当然前提是你需要先安装homebrew软件包管理工具,官网上提供的方法如下

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"