iOS reactNative development environment and create a reactNative project

React Native mainly relies on the following environments:

  • Mac OS X operating system

  • Xcode, version 7.3.0 or higher is recommended.

  • Node.js V6.2.1 or the latest version.

  • watchman和flow。

  • NVM

1. Install xcode, no introduction here

2. Install node.js and open the  official website of Node.js and download it directly.

3. Install homebrew, open the  Homebrew official website , select simplified Chinese as the language, and follow the documentation steps to install

After the installation is complete, open the terminal and enter the command to initialize  Homebrew. The command is: 

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

4. Install watchman and flow through brew,

React NativePackage Manager uses the watchman, flow is Facebookthe company type check produced a library, which is likewise React Nativeused.

If you encounter problems during installation, you may need to update brewand related dependencies, using the command line: brew update brew upgrade if something goes wrong, you need to fix the local brew installer, brew doctor can help you find the problem.

After installing Homebrew, run the following commands in sequence (time-consuming):

  • brew -v
  • brew install watchman
  • brew install flow

5. Install react-native-cli command line tool

Next, we install the command line tool that reflects the native language-CLI through NPM. Enter the following command in the MAC terminal, where -g means global installation.

sudo npm install -g react-native-cli

6. Install NVM

Reace Native Use nvm to manage different node and npm.

6.1 Enter the command in the terminal to install NVM:

git clone https://github.com/creationix/nvm

6.2 Enter nvm file

Enter the following commands in the terminal one by one:

cd nvm /
ls
source nvm.sh
nvm
nvm ls -remote N / A
nvm ls

7, create a reactNative project

After setting up the RN environment, let's create a HelloWorld project.

  1. First create a rn_demo folder named on the desktop 
  2. Enter the created folder in the terminal (cd)
  3. Create a project (The command to create a project is: react-native init HelloWorld

8. Open App.js programming

When the project is running, you can start programming by opening App.js, and you can run command+R directly after programming.

 

Guess you like

Origin blog.csdn.net/sss1507089/article/details/105093780