2 新建及运行 React Native 项目

1 新建项目 --- react-native init 项目名

切换目录下 执行

react-native init RN1

2 运行项目

切换至目录下

cd RN1/

执行

运行ios

react-native run-ios

或者 Xcode 打开 /IOS/RN1.xcodeproj

运行android

react-native run-android

or android studio 打开/Android

运行项目其他方式

To run your app on iOS:

cd /Users/kylinhuang/react/ReactNative/Snap

  • or -

    Open ios/Snap.xcodeproj in Xcode

    Hit the Run button

To run your app on Android:

cd /Users/kylinhuang/react/ReactNative/Snap

Have an Android emulator running (quickest way to get started), or a device connected

react-native run-android

=============

IOS 运行

Xcode /IOS/HelloReactNative.xcodeproj

android

android studio 运行


解决【react-native init awesomeproject没反应】

镜像使用方法(三种办法任意一种都能解决问题,建议使用第三种,将配置写死,下次用的时候配置还在):

1.通过config命令

npm config set registry https://registry.npm.taobao.org

npm info underscore (如果上面配置正确这个命令会有字符串response)

2.命令行指定

npm --registry https://registry.npm.taobao.org

info underscore

3.编辑 ~/.npmrc 加入下面内容

registry https://registry.npm.taobao.org

3 更新

node_modules

npm install

results matching ""

    No results matching ""