Windows 安装react native

1、下载node.js (https://nodejs.org/en/)

2、安装node.js,安装完成后按住 图标键+R ,输入CMD进入命令行终端,输入npm -v

C:\Users\Administrator>npm -v
5.6.0

3、输入 npm install -g react-native-cli 安装命令行工具

C:\Users\Administrator>npm install -g react-native-cli
C:\Users\Administrator\AppData\Roaming\npm\react-native -> C:\Users\Administrator\AppData\Roaming\npm\node_modules\react-native-cli\index.js
+ react-native-cli@2.0.1
added 41 packages in 4.898s

4、查看帮助:

C:\Users\Administrator>react-native --help

  Usage: react-native [command] [options]


  Commands:

    init <ProjectName> [options]  generates a new project and installs its dependencies

  Options:

    -h, --help    output usage information
    -v, --version output the version number


C:\Users\Administrator>

5、安装Android Studio

http://www.android-studio.org/

安装完成后

6、创建应用:

C:\Users\Administrator>react-native init 你的项目名称
This will walk you through creating a new React Native project in C:\Users\Administrator\LoveDemo
'yarn' �����ڲ����ⲿ���Ҳ���ǿ����еij���
���������ļ���
Installing react-native...
Consider installing yarn to make this faster: https://yarnpkg.com
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN react-native@0.55.3 requires a peer of react@16.3.1 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react-native@3.2.1 requires a peer of eslint@^3.17.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ react-native@0.55.3
added 696 packages in 316.306s
Setting up new React Native app in C:\Users\Administrator\LoveDemo
Installing React...
npm WARN eslint-plugin-react-native@3.2.1 requires a peer of eslint@^3.17.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ react@16.3.1
added 1 package in 5.065s
Installing Jest...
npm WARN eslint-plugin-react-native@3.2.1 requires a peer of eslint@^3.17.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ react-test-renderer@16.3.1
+ babel-preset-react-native@4.0.0
+ jest@22.4.3
+ babel-jest@22.4.3
added 299 packages and updated 1 package in 22.568s
To run your app on iOS:
   cd C:\Users\Administrator\LoveDemo
   react-native run-ios
   - or -
   Open ios\LoveDemo.xcodeproj in Xcode
   Hit the Run button
To run your app on Android:
   cd C:\Users\Administrator\LoveDemo
   Have an Android emulator running (quickest way to get started), or a device connected
   react-native run-android (表示已经完成)


 

猜你喜欢

转载自www.cnblogs.com/ywf520/p/8994775.html