一、安装node
Node 版本要求
框架安装需要 Node.js ^16.17.0 || >=16。你可以使用 nvm 或 nvm-windows 在同一台电脑中管理多个 Node 版本。
二.安装watchman
Watchman是facebook的一个开源项目,它开源用来监视文件并且记录文件的改动情况,当文件变更它可以触发一些操作,例如执行一些命令等等。
在使用React Native时,官方推荐推荐安装Watchman,否则你可能会遇到一个Node.js监视文件系统的BUG。
$ brew install watchman
可能会报如下错误,大概就是我Mac的系统版本太新了,不支持当前Mac系统版本
Warning: You are using macOS 14. We do not provide support for this pre-release version. It is expected behaviour that some formulae will fail to build in this pre-release version. It is expected behaviour that Homebrew will be buggy and slow. Do not create any issues about this on Homebrew's GitHub repositories. Do not create any issues even if you think this message is unrelated. Any opened issues will be immediately closed without response. Do not ask for help from Homebrew or its maintainers on social media. You may ask for help in Homebrew's discussions but are unlikely to receive a response. Try to figure out the problem yourself and submit a fix as a pull request. We will review it but may or may not accept it. Error: cmake: unknown or unsupported macOS version: :dunno
解决办法
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
brew update
然后再安装Watchman
查看安装版本
$ watchman -v