Intro
React Native basic commands with practical examples help operators move from an observed problem to a verified result. Start by identifying the installed version, deployment topology, prerequisites, and the exact component being inspected.
This article focuses on React Native commands for developers, DevOps consultants, and technical startup teams. It connects React Native basic commands, React Native examples, React Native cheat sheet, and React Native operations to commands, expected output, failure signals, and recovery decisions that match the selected technology.
The goal is operational safety: observe before changing, limit the blast radius, use placeholders instead of secrets, verify the result, and document how to recover if the expected state is not reached.
Version and Environment Inventory
For React Native commands, Version and Environment Inventory should name the relevant component, the supported version range, prerequisites, a read-only observation, the smallest justified change, and the command or signal that verifies the outcome.
Within Version and Environment Inventory, separate observation from intervention. Capture current state and timestamps first, protect credentials and private material, then change one scoped item only when its blast radius and recovery path are understood.
The important concepts for Version and Environment Inventory are React Native commands, React Native basic commands, React Native examples, React Native cheat sheet, and React Native operations. Related areas such as Expo, Android, and REST API should be included only when they affect prerequisites, compatibility, security, observability, or recovery for this topic.
For Version and Environment Inventory, identify the installed version and deployment topology first. Capture the current observable state with a read-only command from the product's documented CLI or API, then define the expected result and failure signal before making a change.
Within Version and Environment Inventory, use version-appropriate commands from the official documentation. Examples should use explicit placeholders, state prerequisites and blast radius, and include a verification step plus a tested recovery path. Never place real credentials, tokens, private keys, or production identifiers in an article.
Prerequisites
Before running any command, verify that Node.js, npm or Yarn, the React Native CLI, and platform-specific tools are installed. Use these read-only checks:
node --version
# Expected: v18.17.1 or later LTS
npm --version
# Expected: 9.6.7 or later
npx react-native --version
# Expected: 6.3.1 (or your installed version)
adb --version # Android only
# Expected: Android Debug Bridge version 1.0.41
If a command returns "command not found" or a version outside the supported range, install or update the missing tool before proceeding. For example:
npm install -g react-native-cli@latest
# Verify: npx react-native --version
Read-Only Observation
Capture the current environment and project state without changing anything:
npx react-native info
# Expected: prints system info, including OS, Node, npm, React Native version, and platform details
npx react-native doctor
# Expected: reports issues with missing dependencies and suggests fixes
Record the output and timestamp. If react-native info reports an outdated React Native version, plan an upgrade separately rather than mixing it with other changes.
Smallest Justified Change
Example: You need to add a new dependency. Instead of editing package.json directly, use the package manager to update the lockfile consistently:
npm install react-native-vector-icons
# Expected: adds the package and updates package-lock.json
Blast radius: only the project's node_modules and package files change. Recovery: npm uninstall react-native-vector-icons and delete node_modules if necessary.
Verification
After any change, verify the version and environment again:
npx react-native info
# Check that the React Native version is unchanged
git status
# Ensure only intended files changed (package.json, package-lock.json, node_modules if tracked)
If the output differs from expectation, review the change and rollback if needed.
Safe Configuration Path
For React Native commands, Safe Configuration Path should name the relevant component, the supported version range, prerequisites, a read-only observation, the smallest justified change, and the command or signal that verifies the outcome.
Within Safe Configuration Path, separate observation from intervention. Capture current state and timestamps first, protect credentials and private material, then change one scoped item only when its blast radius and recovery path are understood.
The important concepts for Safe Configuration Path are React Native commands, React Native basic commands, React Native examples, React Native cheat sheet, and React Native operations. Related areas such as Expo, Android, and REST API should be included only when they affect prerequisites, compatibility, security, observability, or recovery for this topic.
For Safe Configuration Path, identify the installed version and deployment topology first. Capture the current observable state with a read-only command from the product's documented CLI or API, then define the expected result and failure signal before making a change.
Within Safe Configuration Path, use version-appropriate commands from the official documentation. Examples should use explicit placeholders, state prerequisites and blast radius, and include a verification step plus a tested recovery path. Never place real credentials, tokens, private keys, or production identifiers in an article.
Common Configuration Changes
React Native projects use react-native.config.js, metro.config.js, babel.config.js, and platform-specific files like android/app/build.gradle and ios/Podfile. Always back up the file before editing and use a version control system.
Example: Configuring a custom font.
- Read-only observation: Check current font configuration in
react-native.config.js:
cat react-native.config.js
# If file does not exist, output: No such file or directory
- Smallest change: Create or edit
react-native.config.js:
module.exports = {
assets: ['./assets/fonts/'],
};
- Link the assets (React Native 0.60+ auto-links, but run this for older versions):
npx react-native link
# Expected: font files copied to iOS and Android resource folders
- Verify: Check that fonts are referenced in the platform projects:
grep -R "fontName" ios/ android/
# If custom font is used, you should see matches in Info.plist or fonts.xml
- Recovery: Remove the added line from
react-native.config.jsand unlink:
npx react-native unlink react-native-vector-icons
Blast radius: changes only asset linking. Recovery path: revert the config file and rebuild.
Environment Variables and Secrets
Never hardcode secrets in configuration files. Instead, use environment variables or a secure secrets manager.
Example: Setting an API base URL for development.
- Read-only observation: Check current API URL used in code:
grep -R "API_URL" src/
# Expected: const API_URL = 'http://localhost:3000';
- Smallest change: Create a
.envfile (add to.gitignore):
API_URL=https://api.example.com
- Install and configure react-native-config:
npm install react-native-config
# Follow setup instructions for iOS and Android (add to Podfile, gradle, etc.)
- Verify: In app code, use
Config.API_URLand log it in development:
console.log(Config.API_URL);
// Expected: https://api.example.com
- Recovery: Remove
.envand rollback code changes.
Blast radius: only the app configuration; secrets are not committed.
Verification and Diagnostics
For React Native commands, Verification and Diagnostics should name the relevant component, the supported version range, prerequisites, a read-only observation, the smallest justified change, and the command or signal that verifies the outcome.
Within Verification and Diagnostics, separate observation from intervention. Capture current state and timestamps first, protect credentials and private material, then change one scoped item only when its blast radius and recovery path are understood.
The important concepts for Verification and Diagnostics are React Native commands, React Native basic commands, React Native examples, React Native cheat sheet, and React Native operations. Related areas such as Expo, Android, and REST API should be included only when they affect prerequisites, compatibility, security, observability, or recovery for this topic.
For Verification and Diagnostics, identify the installed version and deployment topology first. Capture the current observable state with a read-only command from the product's documented CLI or API, then define the expected result and failure signal before making a change.
Within Verification and Diagnostics, use version-appropriate commands from the official documentation. Examples should use explicit placeholders, state prerequisites and blast radius, and include a verification step plus a tested recovery path. Never place real credentials, tokens, private keys, or production identifiers in an article.
Running the App and Checking Logs
Start the Metro bundler and run the app on a simulator/emulator or device. Observe logs for errors.
npx react-native start
# Expected: Metro waiting on http://localhost:8081
In a separate terminal:
npx react-native run-android
# Expected: builds and installs the app; if no device, error: No Android devices found.
For iOS:
npx react-native run-ios --simulator="iPhone 14"
# Expected: builds and launches in simulator
Check logs:
npx react-native log-android
# Expected: streams device logs; press Ctrl+C to stop
If the app crashes, logs will show the stack trace. Diagnose based on error messages.
Debugging JavaScript
Use React Native Debugger or Chrome DevTools:
- Start Metro and app as above.
- Open the in-app developer menu (shake device or press Cmd+D in iOS simulator, Ctrl+M in Android emulator).
- Tap "Debug JS Remotely" – this opens Chrome at
http://localhost:8081/debugger-ui. - In Chrome DevTools, inspect console and network requests.
Alternatively, use React Native Debugger standalone:
brew install --cask react-native-debugger
# Then open the app and set debugger host to localhost:8081
Common Diagnostic Commands
npx react-native info– environment summarynpx react-native doctor– health checknpx react-native log-ios– iOS logsnpx react-native log-android– Android logsnpx react-native bundle– bundle JS for production, useful to test minification
Example: Production bundle test:
npx react-native bundle --entry-file index.js --platform android --dev false --bundle-output /tmp/main.jsbundle
# Expected: creates bundle file without errors
Failure Modes and Recovery
For React Native commands, Failure Modes and Recovery should name the relevant component, the supported version range, prerequisites, a read-only observation, the smallest justified change, and the command or signal that verifies the outcome.
Within Failure Modes and Recovery, separate observation from intervention. Capture current state and timestamps first, protect credentials and private material, then change one scoped item only when its blast radius and recovery path are understood.
The important concepts for Failure Modes and Recovery are React Native commands, React Native basic commands, React Native examples, React Native cheat sheet, and React Native operations. Related areas such as Expo, Android, and REST API should be included only when they affect prerequisites, compatibility, security, observability, or recovery for this topic.
For Failure Modes and Recovery, identify the installed version and deployment topology first. Capture the current observable state with a read-only command from the product's documented CLI or API, then define the expected result and failure signal before making a change.
Within Failure Modes and Recovery, use version-appropriate commands from the official documentation. Examples should use explicit placeholders, state prerequisites and blast radius, and include a verification step plus a tested recovery path. Never place real credentials, tokens, private keys, or production identifiers in an article.
Common Failures and Their Indicators
- Metro bundler port conflict: Error:
EADDRINUSE: address already in use :::8081. Recovery: kill process on port 8081 withlsof -ti:8081 | xargs kill, then restart Metro. - Gradle build failure on Android: Often due to mismatched SDK versions or missing dependencies. Check
android/build.gradleandandroid/app/build.gradle. Recovery: clean build withcd android && ./gradlew clean && cd .. && npx react-native run-android. - CocoaPods issues on iOS: Error:
CocoaPods could not find compatible versions for pod "React". Recovery: runcd ios && pod repo update && pod install --repo-update. - JavaScript syntax error: Metro shows red screen with stack trace. Fix syntax and reload with
rin Metro terminal. - Unable to connect to development server: Ensure device and computer are on same network, or use
adb reverse tcp:8081 tcp:8081for Android via USB.
Recovery Best Practices
- Document the failure: exact error message, command used, environment.
- Isolate the cause: use logs and version info.
- Apply the smallest fix: e.g., update one dependency.
- Verify: rerun the command and check expected output.
- Record the solution for future reference.
Example: Recovering from a failed dependency installation.
# Failure: npm install fails with ERESOLVE error
# Recovery: use legacy peer deps or update npm
npm install --legacy-peer-deps
# Verify: package.json and lockfile updated, npx react-native start works
Operations Checklist
For React Native commands, Operations Checklist should name the relevant component, the supported version range, prerequisites, a read-only observation, the smallest justified change, and the command or signal that verifies the outcome.
Within Operations Checklist, separate observation from intervention. Capture current state and timestamps first, protect credentials and private material, then change one scoped item only when its blast radius and recovery path are understood.
The important concepts for Operations Checklist are React Native commands, React Native basic commands, React Native examples, React Native cheat sheet, and React Native operations. Related areas such as Expo, Android, and REST API should be included only when they affect prerequisites, compatibility, security, observability, or recovery for this topic.
For Operations Checklist, identify the installed version and deployment topology first. Capture the current observable state with a read-only command from the product's documented CLI or API, then define the expected result and failure signal before making a change.
Within Operations Checklist, use version-appropriate commands from the official documentation. Examples should use explicit placeholders, state prerequisites and blast radius, and include a verification step plus a tested recovery path. Never place real credentials, tokens, private keys, or production identifiers in an article.
Use this checklist for any React Native operation:
- Identify component and version: e.g., React Native 0.72.3, Node 18.17.1, target platform Android/iOS.
- Run read-only observation:
npx react-native infoand capture output. - Define expected result and failure signal: e.g., command returns exit code 0 and no error in logs.
- Perform smallest justified change: one command or config edit.
- Verify: rerun observation or specific check (e.g., run app and see UI).
- Document and recover if needed: note what was done and how to revert.
Example checklist item for adding a library:
- Component:
react-native-vector-icons - Version: latest compatible with RN 0.72.x
- Prerequisites: project initialized, git clean
- Read-only:
npm ls react-native-vector-icons(expected: empty) - Change:
npm install react-native-vector-icons - Verify: import Icon in a test screen and render, run app and see icon displayed
- Recovery:
npm uninstall react-native-vector-iconsand remove usage
Conclusion
React Native basic commands with practical examples are useful only when each recommendation is version-scoped, observable, and reversible where the technology permits. Copying a command without checking prerequisites and expected output is not an operations procedure.
As a next step, choose one low-risk verification for React Native commands, record the current state, run the documented check, compare the result with the expected signal, and review dependencies such as Expo, Android, and REST API.
A reliable technical workflow makes failure visible, protects sensitive values, limits changes to the intended resource, and defines recovery verification before an incident forces the decision.