新建项目

React Native 创建项目

Last login: Wed Jan  4 14:46:08 on ttys003

192:~ renwei$ cd /Users/renwei/学习/web端/React Native 

192:React Native renwei$ ls

AHelloWorld BViewDemo

192:React Native renwei$ react-native init RWBuy

This will walk you through creating a new React Native project in /Users/renwei/学习/web端/React Native/RWBuy

Installing react-native from npm...

Consider installing yarn to make this faster: https://yarnpkg.com

// 项目创建成功

Setting up new React Native app in /Users/renwei/学习/web端/React Native/RWBuy

Installing React...

Installing Jest...

npm WARN prefer global marked@0.3.6 should be installed with -g

To run your app on iOS:

   react-native run-ios

   - or -

   Open ios/RWBuy.xcodeproj in Xcode

   Hit the Run button

To run your app on Android:

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

   react-native run-android

192:React Native renwei$ 

注意:React Native升级后创建项目出现问题的处理方案

报错 :Cannot find module 'invariant'

解决方案:

原来是新版本的cli构建工具更新的时候,要同时更新npm的版本。

sudo npm  update npm -g  

 

原文地址:https://www.cnblogs.com/r360/p/6249524.html