Installation
The React Native CLI is included when you create a new project. You can run commands usingnpx:
Available Commands
Project Initialization
- init - Create a new React Native project
Development
- start - Start the Metro development server
- run-android - Build and run your app on Android
- run-ios - Build and run your app on iOS
Building
- build-android - Build an Android app for production
- build-ios - Build an iOS app for production
- bundle - Build the JavaScript bundle
Debugging
- log-android - View Android device logs
- log-ios - View iOS device logs
Configuration
- metro-config - Configure the Metro bundler
- react-native-config - Configure React Native settings
Basic Workflow
Global Options
Most commands support these common options:| Option | Description |
|---|---|
--version | Show version number |
--help | Show help information |
--verbose | Increase logging verbosity |
--config <path> | Path to the CLI configuration file |
CLI Configuration
You can configure CLI behavior using areact-native.config.js file in your project root:
react-native.config.js
Environment Variables
Metro Port
Skip Package Manager
Troubleshooting
Clear Cache
If you encounter bundling issues:Check CLI Version
Verbose Logging
For detailed output during debugging:Next Steps
Start Command
Learn how to start the Metro development server
Run Commands
Build and run your app on simulators and devices
Bundle Command
Create production JavaScript bundles
Metro Config
Configure the Metro bundler