Configuring the React native environment

Source: Internet
Author: User
Tags install homebrew install node

One. Install Homebrew: "Homebrew installs the stuff you need that Apple didn ' t.--homebrew OS X more complete".

Homebrew's official website (multi-lingual version) provides a simple and concise description of how to install and use the tool, and offers its own wiki.

The installation of brew is simple, with a ruby command, Ruby is already installed by default on Mac systems:

Ruby-e "$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install)"

Wait for a period of time will appear

Press RETURN to continue or any other key to abort

Enter your computer password after hitting enter: (the terminal will not change in the process of entering the password)

Prompt after entering password

Downloading and installing Homebrew ...

Continue to wait patiently.

Two. Install node. JS:

Use Homebrew to install Nvm,watchman and flow. (It is recommended to update brew every time you use Homebrew, command:Brew update )

1. Install NVM:

Input in Terminal:

Brew Install NVM

finally the terminal will prompt

It probably means that if you don't have a. nvm file, you'll create one, enter it in the terminal.

mkdir ~/.NVM

You can create the. nvm file now

, then go to ~/.bash_profile or configure the following in the shell configuration file:

Export NVM_DIR=~/.NVM

SOURCE $ (Brew--prefix NVM)/nvm.sh

The operation is as follows

Go to home directory first: CD ~

Open a. bash_profileopen file:

Open. Bash_profile

If the file does not exist, create a

touch. Bash_profile

Open and then copy the content you want to configure and save the exit

Now that the NVM is installed, the installation is complete.

2. Install node. js with NVM

Terminal input Command :

NVM Install node && NVM alias default node

Note: If the smooth installation is complete, skip the steps below and go directly to step three to install the Watchman and flow links.

NVM By default is downloaded from the http://nodejs.org/dist/, foreign servers, must be very slow,

Fortunately, NVM and the support to download the package from the mirror server, so we can easily from the seven Cow node dist image download:

$ nvm_nodejs_org_mirror=https://npm.taobao.org/dist NVM Install 0.11.11

So you'll see a very fast progress bar:

######################################################################## 100.0%nowusingnode v0.11.11

If you do not want to enter the environment variable nvm_nodejs_org_mirror every time, then I recommend you to add to the. bashrc file:

# nvmexportnvm_nodejs_org_mirror=https://npm.taobao.org/distsource~/git/nvm/nvm.sh

Then the terminal input command:

NVM Install node && NVM alias default node

If you use NVM, the installation fails. You can try to install node: Brew Install node directly using homebrew

Three. Install Watchman and Flow:

Terminal input

Brew Install Watchman

Brew Install Flow

Everything goes well.

It is recommended that you run Brew update && brew upgrade regularly to keep your applications up to date.

Brew Update && Brew upgrade

Three. Initialize the project:

First install the Xcode6.3 or later version.

Upon completion, the terminal executes

NPM install-g REACT-NATIVE-CLI

REACT-NATIVE-CLI is a command-line tool that completes the remaining installation. It is installed through NPM. This will install the react-native command line in your terminal, you only need to do it once.

Then

React-native Init Awesomeproject

This command obtains the source code and dependency packages for React Native, and then creates a new Xcode project in Awesomeproject/ios/awesomeproject.xcodeproj and awesomeproject/ Android/app Create a Gradle project below.

Configuring the React native environment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.