Install react native on Windows

1. Download node.js (https://nodejs.org/en/)

2. Install node.js, press the icon key + R after the installation is complete, enter CMD to enter the command line terminal, enter npm -v

C:\Users\Administrator>npm -v
5.6.0

3. Enter npm install -g react-native-cli to install the command line tool

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. View help:

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. Install Android Studio

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

After installation is complete

6. Create an application:

 

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 Is ...
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 ( indicates that it has been completed )


 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325378015&siteId=291194637