React Native Mac 环境搭建
来源:互联网 发布:java实现扫码支付 编辑:程序博客网 时间:2024/05/20 05:05
打开终端:
brew install node
看到
输入npm -v 后查看安装成功的node.js
然后执行
npm install -g react-native-cli
安装react-native 命令行工具
react-native –help
可以查看命令行工具支持的命令
接下来安装Xcode
之后安装Android Studio
然后初始化一个应用
react-native init FirstApp
如果收到-bash:react-native:command not found
则输入
npm list -g | head -n 1
得到
/usr/local/Cellar/node/8.1.4/lib
得到react native 安装的路径
open .bash_profile
添加
export PATH=”/usr/local/Cellar/node/8.1.4/bin:$PATH”
source .bash_profile
再次执行
react-native init FirstApp
则看到成功创建第一个apk
用命令后运行iOS项目
cd FirstApp
执行
react-native run-ios
如果遇到错误:
xcrun: error: unable to find utility “instruments”, not a developer tool or in PATH
则要执行
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/
再次运行遇到错误:
Installing build/Build/Products/Debug-iphonesimulator/MyFirsrRNapp.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, “:CFBundleIdentifier”, Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/MyFirsrRNapp.app/Info.plist
Print: Entry, “:CFBundleIdentifier”, Does Not Exist
修改方法:
react-native 中文参考网有解释:
http://reactnative.cn/docs/0.49/getting-started.html#content
http://blog.csdn.net/s8460049/article/details/73330784
首先要启动一个android模拟器
react-native run-android
分别运行俩个平台的项目
要安装好各自的模拟器
可以通过Xcode 运行iOS项目,双击
FirstApp.xcodeproj
点击运行按钮
通过a s 运行android项目,open新的项目
启动模拟器
点击运行
- React Native Mac环境搭建
- 搭建react native mac 环境
- mac搭建react-native环境
- React Native Mac 环境搭建
- React Native环境搭建 (android/mac环境)
- 1.Mac 下搭建React-Native环境
- React Native之环境搭建(Mac版)
- Mac React-Native环境搭建及使用
- Mac系统下React Native环境搭建
- Mac系统下React Native环境搭建
- mac react-native 环境搭建与运行
- Mac下搭建react native开发环境
- MAC搭建React Native开发环境
- react-native mac-ios环境搭建
- react native mac下环境搭建
- react native mac 下环境搭建
- Mac环境下React Native开发App环境搭建
- React Native 环境的搭建(iOS\mac环境)
- 防止用户连续多次点击提交请求,防止对服务器造成负担
- PAT (Advanced Level) Practise 1022 Digital Library (30)
- Android Wi-Fi 2.4G及5G信道一览表
- Nexus3搭建Maven私有库(三)
- MFC在窗体上画线
- React Native Mac 环境搭建
- WaterGems第一讲:水力模拟计算
- html基础
- 【剑指offer】面试题21:调整数组顺序使奇数位于偶数前面
- android studio 常量表达式错误
- 最新虚拟币交易平台源码 带手机版+APP 山寨币交易平台包安装包对接区块链ICO众筹源码
- 2822: [AHOI2012]树屋阶梯
- Android高新面试题2017汇总
- 苹果机器学习博客姗姗来迟:使用改进的生成对抗模型,提高图像真实性,降低图像的标记成本