Mac 配置react native环境

来源:互联网 发布:开淘宝店挣钱么 编辑:程序博客网 时间:2024/06/05 10:46
1.homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2.autojump nvm oh-my-zsh
2.1 autojump
brew install autojump
2.2 oh-my-zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
vi .zshrc
找到 plugins=(git autojump zsh-nvm)
git clone https://github.com/lukechilds/zsh-nvm ~/.oh-my-zsh/custom/plugins/zsh-nvm
source .zshrc 生效配置文件

3.nvm 管理node版本  的工具
3.1配置nvm 镜像拉取地址
export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node
export NVM_IOJS_ORG_MIRROR=http://npm.taobao.org/mirrors/iojs
3.2npm (装完node 会自带一个npm包管理工具)
npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global
4.yarn
4.1
brew install yarn (类似npm)
4.2 全局安装 react-native-cli
yarn global add react-native-cli
4.3 配置
yarn config set registry https://registry.npm.taobao.org --global
yarn config set disturl https://npm.taobao.org/dist --global
5.react-native-cli
5.1 全局安装 react-native-cli
yarn global add react-native-cli

6.watchman
brew install watchman
7.flow (可选)
brew install flow

8.iterm2终端
9.用户根目录 cd
Mac 根目录 /
10. 一些常用命令
rm -rf folder
vi files
11. 生成sshkey
ssh-keygen -t rsa
cd .ssh
vi xxx.pub
12.gco = git checkout
gaa = git add .
gcmsg = git commit -m ‘xxxxx’
gba -v = git branch -v
gco -b (xxx) =git checkout -b (xxx)
git push origin (需要推送的本地分支):(目标远程分支)

git push origin :test 删除远程test仓库
git branch -D 删除本地分支