React Native CLI
Command line tools that ship with
react-native in form of the
react-nativebinary, so you can call
npx react-nativedirectly from your project.
- Creating a new React Native project
- Usage in an existing React Native project
- Updating the CLI
Our release cycle is independent of
react-native. We follow semver and here is the compatibility table:
This repository contains tools and helpers for React Native projects in form of a command line tool. There's been quite some confusion around that since the extraction from React Native core. Let's clear them up:
- There are currently two CLIs:
@react-native-community/cli– the one used directly by
react-native. That makes it a transitive dependency of your project.
react-native-cli– an optional global convenience package, which is a proxy to
@react-native-community/cliand global installation helper. Please consider it legacy, because it's not necessary anymore.
- When we say "the CLI" we mean
- We update the CLI independently of React Native itself. Please see how to use the latest version.
- This is a monorepo to keep stuff organized.
We're actively working to make any indirections gone.
Creating a new React Native project
There are two ways to start a React Native project.
This method is preferred if you don't want to install global packages.
npx react-native init MyApp
Using global CLI (legacy)
You'll need to install a global module
react-native-cli and follow instructions there.
We strongly encourage you to only use global
react-native-clifor bootstrapping new projects. Use local version for everything else.
You can find out more about init command from the documentation
Usage in an existing React Native project
Once you're inside an existing project, a local
react-native binary will be available for you to use. Feel free to use Yarn to call it directly.
start command in terminal:
yarn react-native start# or:npx react-native start# ornode ./node_modules/.bin/react-native start
You can also add npm scripts to call it with whichever package manager you use:
Updating the CLI
Because we release independently of
react-native, it happens that you may be locked on a version without fixes for bugs that affect you. Here's how to get it sorted:
- If you use lock files (
package-lock.json) - find the
@react-native-community/clientry, remove it, run
npm installonce again.
- If you don't use lock files – remove
yarn list @react-native-community/clior
npm list @react-native-community/cliand verify you're on the latest version.
After performing these steps you should be on the latest CLI version. Feel free to do it once in a while, because we release often.
- Michał Pierzchała (@thymikee) - Callstack
- Mike Grabowski (@grabbou) - Callstack
- Kacper Wiszczuk (@esemesek) - Callstack
Everything inside this repository is MIT licensed.