1 新建react项目:
create-react-app 项目名
cd 项目
npm start
npm run build
2 新建RN项目:
react-native init AwesomeProject
cd AwesomeProject
react-native run-ios
3 RN指定模拟器型号运行:
react-native run-ios –simulator ‘iPhone X’
4 RN在另一个端口运行项目:
react-native run-ios –port=8082
5 更改node版本:
node -v
sudo npm cache clean -f // 清缓存
sudo npm install n -g // 安node版本管理工具n
sudo n stable // 最新版本
sudo n 8.11.4 // 指定版本
6 react项目build后直接打开index.html文件方法:
npm install http-server -g // 全局安装http-server
http-server // 进入build文件夹 运行http-server
7 暴露配置文件:
npm run eject
8 git config 配置
git config –global user.name lala
git config –global user.email xxx@xxx.com