Skip to content

Instantly share code, notes, and snippets.

@HendrikPetertje
Last active August 20, 2016 02:38
Show Gist options
  • Save HendrikPetertje/8bc2b162d2b4557317c0 to your computer and use it in GitHub Desktop.
Save HendrikPetertje/8bc2b162d2b4557317c0 to your computer and use it in GitHub Desktop.
React Native course

Installing react native

like a baws
ps: MacosX only sorry linux fans.

Installing NodeJS using ndenv

As of writing this in september 2015 react native requires installing nodejs 4.0.+

I like ndenv so let’s use that.

Open a terminal and issue the following commands (I’m assuming you have home-brew and some form of git installed here)

Let's remove node from homebrew if you have that

	$ brew remove node
	$ brew prune node

Let's install ndenv

	$ git clone https://github.com/riywo/ndenv ~/.ndenv
	$ git clone https://github.com/riywo/node-build.git ~/.ndenv/plugins/node-build
	$ echo 'export PATH="$HOME/.ndenv/bin:$PATH"' >> ~/.bash_profile
	$ echo 'eval "$(ndenv init -)"' >> ~/.bash_profile
	$ exec $SHELL -l

Then install node

	$ ndenv install v4.0.0 # react-native uses 4.0.0 specifically sorry.
	$ ndenv global v4.0.0
	$ ndenv rehash

2. Install some dependencies

From the console run. I’m HEADing watchman since homebrews default (older) version 3.7.7 (as of this writing) messes up react-native in a horrible way

	$ brew update
	$ brew install --HEAD watchman
	$ brew install flow

3. Install Xcode from the app store

Visit the app store on your machine to install xcode, open it 1 time to accept the terms and conditions

4. Install react-native

with all dependencies running it’s time to install react native

$ npm install -g react-native-cli

But I'm an Android Fanboy or use Linux!

5. Install the android SDK using homebrew

Run the following command to install the sdk (software development kit)

$ brew install android-sdk
$ echo 'export ANDROID_HOME=/usr/local/opt/android-sdk' >> ~/.bash_profile

Open a new terminal screen and run (don't close your terminal screen after opening)

$ android

In the window that loads select the following items:

  • Android SDK Build-tools version 23.0.1
  • Android 6.0 (API 23) (everything in api 32)
  • API 22 --> Intel x86 Atom System Image (for Android 5.1.1 - API 22)
  • Extras --> Android Support Repository
  • Extras --> Android Support Library
  • Extras --> Intel x86 Emulator Accelerator (HAXM installer)

In some cases you need to alter HAXM stuff just run this (you might not need it, do this if stuff fails later!

$ open /usr/local/opt/android-sdk/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM.dmg

Creating a virtual device

if you plan on using a virtual device instead of a hardware connected to your machine Open a console and run (don't close the terminal after executing the command):

$ android avd

Create a new avd and match with the config below:

enable pictures


Thanks for reading, see you at the course!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment