Command line tools to interact with React Native projects
—
Complete command-line interface providing project initialization, configuration management, diagnostics, and maintenance tools. Commands are categorized as either project commands (requiring React Native project configuration) or detached commands (working standalone).
Commands that require a React Native project configuration and only work within a React Native project directory.
Outputs the current CLI configuration as JSON for debugging and inspection.
npx react-native config [options]
Options:
--platform <platform> Output configuration for a specific platform (ios, android, etc.)
--verbose Increase logging verbosityUsage Examples:
# Display full configuration
npx react-native config
# Display iOS-specific configuration
npx react-native config --platform ios
# Display Android-specific configuration
npx react-native config --platform androidCleans the project by removing React Native related caches and modules to resolve build and dependency issues.
npx react-native clean [options]
Options:
--include <string> Comma-separated flag of caches to clear
--project-root <string> Root path to React Native project (default: current directory)
--verify-cache Whether to verify the cache (npm only)
--verbose Increase logging verbositySupported cache types:
metro: Metro bundler cachewatchman: Watchman file watching cache (macOS/Linux)android: Android build cache and gradle cachecocoapods: CocoaPods cache (macOS only)yarn: Yarn cachenpm: npm cachebun: Bun cacheUsage Examples:
# Clean all caches
npx react-native clean
# Clean specific caches
npx react-native clean --include metro,android
# Clean with cache verification
npx react-native clean --verify-cache
# Clean from specific project root
npx react-native clean --project-root /path/to/projectDisplays system information including React Native version, platform tools, and development environment details.
npx react-native info [options]
Options:
--verbose Increase logging verbosityUsage Examples:
# Display system information
npx react-native infoSample output includes:
Commands that work without requiring a React Native project configuration and can be run from any directory.
Initializes a new React Native project with the specified name and configuration options.
npx react-native init [projectName] [options]
Arguments:
projectName Name of the new React Native project (optional)
Options:
--version <string> React Native version to install in the template
--template <string> Uses a custom template (npm package name or path)
--pm <string> Use specific package manager (yarn, npm, bun). Default: npm
--directory <string> Uses a custom directory instead of <projectName>
--title <string> Uses a custom app title name for application
--skip-install Skips dependencies installation step
--install-pods [boolean] Determine if CocoaPods should be installed (iOS)
--package-name <string> Custom package name (Android) and bundle ID (iOS)
--platform-name <string> Name of out of tree platform (e.g., react-native-macos)
--skip-git-init Skip git repository initialization
--replace-directory [boolean] Replaces the directory if it already exists
--yarn-config-options <string> Extra options for .yarnrc.yml file (key=value,key2=value2)
--verbose Increase logging verbosityUsage Examples:
# Create new project with default settings
npx react-native init MyApp
# Create project with TypeScript template
npx react-native init MyApp --template react-native-template-typescript
# Create project with specific React Native version
npx react-native init MyApp --version 0.72.0
# Create project with custom package name
npx react-native init MyApp --package-name com.company.myapp
# Create project with Yarn
npx react-native init MyApp --pm yarn
# Create project without installing dependencies
npx react-native init MyApp --skip-install
# Create project in custom directory
npx react-native init MyApp --directory my-custom-directory
# Create project for out-of-tree platform
npx react-native init MyApp --platform-name macos
# Replace existing directory
npx react-native init MyApp --replace-directory trueDiagnoses and optionally fixes common Node.js, iOS, Android, and React Native development environment issues.
npx react-native doctor [options]
Options:
--fix Attempt to fix all diagnosed issues automatically
--contributor Add healthchecks for React Native contributors
--verbose Increase logging verbosityUsage Examples:
# Run diagnostics only
npx react-native doctor
# Run diagnostics and attempt fixes
npx react-native doctor --fix
# Include contributor-specific checks
npx react-native doctor --contributorDiagnostic checks include:
Commands are automatically registered with the following features:
--verbose flagtype ProjectCommand = {
name: "config" | "clean" | "info";
detached: false;
requiresProject: true;
};
type DetachedCommand = {
name: "init" | "doctor";
detached: true;
requiresProject: false;
};All commands support these global options:
--verbose: Increase logging verbosity for debugging--help: Display command-specific help information--version: Display CLI version (when used without command)Install with Tessl CLI
npx tessl i tessl/npm-react-native-community--cli