按照rn官网上操作,执行
brew install watchman
按照失败,错误日志如下
react-native 官网: https://reactnative.cn/docs/getting-started.html
$ brew install watchman
touch: /usr/local/Homebrew/.git/FETCH_HEAD: Permission denied
touch: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/.git/FETCH_HEAD: Permission denied
touch: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/.git/FETCH_HEAD: Permission denied
==> Downloading https://homebrew.bintray.com/bottles/watchman-4.9.0.high_sierra.
Already downloaded: /Users/zhuge/Library/Caches/Homebrew/watchman-4.9.0.high_sierra.bottle.tar.gz
==> Pouring watchman-4.9.0.high_sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/doc/watchman-4.9.0
/usr/local/share/doc is not writable.
You can try again using:
brew link watchman
==> launchctl unload -F /Users/zhuge/Library/LaunchAgents/com.github.facebook.wa
==> Summary
🍺 /usr/local/Cellar/watchman/4.9.0: 23 files, 2MB
解决方法:
在终端执行以下命令后,输入密码稍等片刻即可,然后重新进行安装watchman
sudo chown -R $(whoami) /usr/local