一、下載node.js (https://nodejs.org/en/)node
二、安裝node.js,安裝完成後按住 圖標鍵+R ,輸入CMD進入命令行終端,輸入npm -vreact
C:\Users\Administrator>npm -v 5.6.0
三、輸入 npm install -g react-native-cli 安裝命令行工具android
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
四、查看幫助:ios
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>
五、安裝Android Studionpm
http://www.android-studio.org/
安裝完成後json
六、建立應用:react-native
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 (表示已經完成)