I am running the following commands in the DOS console on a Windows 7 (64-bit) machine.
npm install -g yarn
yarn add global react-native
yarn add global reac
NEW SEP 2019, now it's more simple, use node10 and expo: (easy way)
npm install -g expo-cli
*to create project:
expo init AwesomeProject
cd AwesomeProject
npm start
*install the app 'expo' on your phone, and scan the qr code for the project and you can start to view your app
more info: https://facebook.github.io/react-native/docs/getting-started.html
UPDATE OCT 2018 Create React Native App (now discontinued) has been merged with Expo CLI You can now use expo init to create your project. See Quick Start in the Expo documentation for instructions on getting started using Expo CLI.
Unfortunately, react-native-cli
is outdated. Starting 13 March 2017, use create-react-native-app
instead. Moreover, you shouldn't install Yarn with NPM. Instead, use one of the methods on the yarn
installation page.
yarn
Via NPM. According to its installation docs, you shouldn't install yarn
via npm
, but if necessary, you can still install it with a pre-v5 version of npm
.
UPDATE 2018 - OCTOBER
Node 8.12.0 and NPM 6.4.1 is already compatible with create-react-native-app. Really some minors previous versions too. You don't need more downgrade your npm.
On Ubuntu.
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
On macOS, use Homebrew or MacPorts.
brew install yarn
sudo port install yarn
yarn global add create-react-native-app
source ~/.bashrc
create-react-native-app myreactproj