We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
工欲善其事,必先利其器。整个示例代码都是以Mac OS X系统为基础的;
$ node -v => v5.1.1 $ react-native cli -v => react-native-cli: 0.1.10 => react-native: 0.20.0
推荐使用 nvm 管理你的 Node.js 版本
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.26.0/install.sh | bash $ source ~/.nvm/nvm.sh $ nvm install 5.1.1 $ nvm use 5.1.1
常用 nvm 命令
$ nvm use <version> // 切换版本 $ nvm ls-remote // 查看远程 Node.js 的版本 $ nvm ls // 查看本地安装的 Node.js 的版本
在安装 react-native 之前,需要确保 Node.js 已经安装且在环境变量中;需要确保 Xcode 已经安装且最好是7.1 或者更高版本
$ brew install watchman $ brew install flow
$ npm install -g react-native-cli // -g 表示全局安装
注:如果安装不成功或者很慢,是因为react-native命令是从npm官网源安装,我们可以改用淘宝镜像源来安装
$ npm config set registry https://registry.npm.taobao.org $ npm config set disturl https://npm.taobao.org/dist
或者如果你已经安装cnpm:
// 在 /usr/local/lib/node_modules/react-cli/index.js中找到下面一行代码 run('npm install --save react-bative', function(e) { 修改为 run('cnpm install --save react-bative', function(e) {
改用 cnpm 重新安装 react-native-cli,你会发现是如此的快...
$ cnpm install -g react-native-cli // -g 表示全局安装
$ brew -v => Homebrew 0.9.5 $ npm -v => 3.3.12 $ cnpm -b => 3.3.12 $ node -v => v5.1.1 $ nvm --version => 0.17.3 $ react-native cli -v => react-native-cli: 0.1.10 => react-native: 0.20.0
$ git clone git@github.com:chenbin92/React-native-example.git $ cd React-native-example
使用 npm 安装项目的依赖: npm
npm
$ npm install
node_modules
$ npm start $ react-native run-ios
ip
jsCodeLocation = [NSURL URLWithString:@"http://192.168.1.101:8081/index.ios.bundle"];
commond + D
在升级之前,我们可以运行 npm infi react-native查看react-native的版本信息:
npm infi react-native
$ npm update -g react-native-cli // 更新本地 react-native-cli的版本 $ npm install --save react-native@0.20 // @后面跟需要升级的版本号 $ react-native upgrade
$ npm install --save react-native@0.18 // @后面跟需要升级的版本号 $ react-native upgrade
React-Native入门指南 React Native: 配置和起步 React Native库版本升级(Upgrading)与降级讲解
The text was updated successfully, but these errors were encountered:
No branches or pull requests
环境搭建 (iOS)
工欲善其事,必先利其器。整个示例代码都是以Mac OS X系统为基础的;
React Native主要依赖的环境:
项目依赖的版本
安装 node
推荐使用 nvm 管理你的 Node.js 版本
常用 nvm 命令
安装 react-native
在安装 react-native 之前,需要确保 Node.js 已经安装且在环境变量中;需要确保 Xcode 已经安装且最好是7.1 或者更高版本
1. 通过Homebrew安装watchman和flow:
2. 安装完成后,我们就可以通过 npm 安装react-native-cli 的命令行工具:
注:如果安装不成功或者很慢,是因为react-native命令是从npm官网源安装,我们可以改用淘宝镜像源来安装
或者如果你已经安装cnpm:
改用 cnpm 重新安装 react-native-cli,你会发现是如此的快...
3. 检查是否安装正确:
Clone Repo
安装依赖
使用
npm
安装项目的依赖:npm
node_modules
- contains the npm packages for the tools we need在 iOS simulator运行应用
在设备上运行应用
ip
地址,如jsCodeLocation = [NSURL URLWithString:@"http://192.168.1.101:8081/index.ios.bundle"];
调试
commond + D
即可更新 React Native 项目依赖包版本
在升级之前,我们可以运行
npm infi react-native
查看react-native的版本信息:降级 React Native 项目依赖包版本 (与更新一样)
相关文章推荐:
React-Native入门指南
React Native: 配置和起步
React Native库版本升级(Upgrading)与降级讲解
The text was updated successfully, but these errors were encountered: