? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? RN學(xué)習(xí)之路1:mac系統(tǒng)下搭建RN環(huán)境
1师骗,安裝homebrew?
? ? ?????終端輸入 ruby -e "$(curl --insecure -fsSL ????????https://raw.githubusercontent.com/Homebrew/install/master/install)"
? ????? 如果遇到報錯:curl: (7) Failed to connect to raw.githubusercontent.com port 443 after 13 ms: Connection refused
? ????? 請輸入?/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
2蔽午,安裝RN的依賴
? ? brew install node
? ? brew install watchman?
? ? //需要依賴python報錯:Error: python@3.10: the bottle needs the Apple Command Line Tools to be installed.
? ? 解決:官網(wǎng)下載安裝:
(1)下載python的地址:https://www.python.org/downloads/
(2)安裝完畢后終端輸入python3,如下圖所示即安裝成功
? ? brew install flow
3嗅钻,安裝React Native
? ??npm install -g react-native-cli
4,創(chuàng)建RN項目
? ??react-native init HelloRN
報錯?Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./HelloRN/ios && pod install".
解決:按照提示操作即可
有可能需要更新cocoapods版本
sudo gem install cocoapods