1.安裝homebrew
Homebrew, Mac系統(tǒng)的包管理器浦译,用于安裝NodeJS和一些其他必需的工具軟件。
$: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安裝需要的工具溯职,
2.修改環(huán)境變量,從國內(nèi)的鏡像源下載,加載下載進度
1.1打開.bash_profile
$:vi ~/.bash_profile
1.2添加環(huán)境變量精盅,加入下面的語句
export HOMEBREW_BOTTLE_DOMAIN=http://7xkcej.dl1.z0.glb.clouddn.com
1.3使.bash_profile文件生效
$:source ~/.bash_profile
3.安裝node
$:brew install node
4.設置npm鏡像
npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global
5.安裝react-native-cli,
是Yarn谜酒、React Native的命令行工具
npm install -g yarn react-native-cli
6切換鏡像源
yarn config set registry https://registry.npm.taobao.org --global
yarn config set disturl https://npm.taobao.org/dist --global
7.安裝Watchman
由Facebook提供的監(jiān)視文件系統(tǒng)變更的工具叹俏。安裝此工具可以提高開發(fā)時的性能(packager可以快速捕捉文件的變化從而實現(xiàn)實時刷新)。
brew install watchman
安裝到此結束