React Native and Expo Environment with PNPM
Professional configuration of the React Native development environment using Expo CLI and the PNPM package manager for iOS and Android.
This guide details the standard technical procedure for preparing a professional development environment for React Native using Expo and the PNPM dependency manager. It covers everything from system prerequisites to the initialization and local deployment of a modern project with cross-platform support (iOS and Android).
1. Expo and PNPM: The Ultimate Combination
Sección titulada «1. Expo y PNPM: La Combinación Definitiva»Currently, official React documentation and the technical community recommend the combination of Expo and PNPM as the absolute standard working environment:
- Expo Router: File-based routing (similar to Next.js/Astro) that is fully integrated and typed.
- PNPM (Performant NPM): Resolves the serious historical issues of NPM's slowness and vulnerability through an architecture based on hard links (hard links) and content-addressable storage.
- EAS Build/Submit: Cloud compilation of native binaries (
.apk,.aab,.ipa) without the need for expensive local hardware.
2. Environment Prerequisites
Sección titulada «2. Requisitos Previos del Entorno»Before initializing any application, it is essential to have the following tools installed on the system:
Core Tools
Sección titulada «Herramientas de Base»- Node.js (LTS): The active Long-Term Support version is recommended.
- Package Manager:
pnpm(Installed globally vianpm i -g pnpmorcorepack enable). - Git: For project version control.
For Android Emulation (Windows/macOS/Linux)
Sección titulada «Para Emulación Android (Windows/macOS/Linux)»- JDK (Java Development Kit): Install OpenJDK 17 or higher.
- Android Studio: Install Android Studio and configure:
- Android SDK: Ensure you have downloaded the SDK version recommended by the latest Expo release.
- Android SDK Platform-Tools: Must be added to the system environment variables (
PATH). - Virtual Device (AVD): Create an emulator with Google Play Services for local testing.
For iOS Emulation (macOS Only)
Sección titulada «Para Emulación iOS (Exclusivo en macOS)»- Xcode: Downloaded directly from the Mac App Store.
- Xcode Command Line Tools: Install by running in the terminal:
Ventana de terminal xcode-select --install - Cocoapods: iOS dependency manager (
sudo gem install cocoapods).
3. Project Initialization with PNPM
Sección titulada «3. Inicialización del Proyecto con PNPM»To create a new modern React Native project with Expo using PNPM, run the official interactive command in your working directory:
# Crear proyecto con la plantilla por defecto recomendada usando PNPMpnpm dlx create-expo-app mi-app-ia --template tabsRecommended Directory Structure
Sección titulada «Estructura de Directorios Recomendada»mi-app-ia/├── app/ # Directorio de rutas (Expo Router)│ ├── (tabs)/ # Grupo de pestañas de navegación inferior│ │ ├── _layout.tsx # Definición del enrutador de pestañas│ │ ├── index.tsx # Pantalla de inicio│ │ └── explorar.tsx # Pantalla de exploración│ ├── _layout.tsx # Enrutador raíz (Modales, Autenticación, etc.)│ └── +not-found.tsx # Pantalla 404 de respaldo├── assets/ # Imágenes, fuentes y recursos multimedia├── components/ # Componentes UI reutilizables├── constants/ # Colores, configuraciones globales y APIs├── package.json # Dependencias y scripts del ciclo de vida└── app.json # Configuración nativa del manifiesto de Expo4. Running in Development Mode
Sección titulada «4. Ejecución en Modo de Desarrollo»Once the dependency installation with PNPM is complete, access the project folder and start the development server:
cd mi-app-iapnpm expo startInteractive Launch Options in the Console
Sección titulada «Opciones de Lanzamiento Interactivas en la Consola»When starting the Expo server, a QR code and interactive control options will be displayed:
- a Open in Android: Launches the application in an active Android Studio emulator or a USB-connected device.
- i Open in iOS: Launches the application in the Xcode iOS simulator (requires macOS).
- w Open in Web: Initializes the web version of the application (useful for rapid prototyping).
- r Reload Application: Forces a full UI refresh on all connected devices.
5. Environment Checklist
Sección titulada «5. Lista de Verificación del Entorno»Ensure the correct state of your environment before starting development. Run the automated Expo diagnostic command via PNPM:
pnpm dlx expo-doctorDiagnostic Results and Status
Sección titulada «Resultados de Diagnóstico y Estado»- ✓ Node.js LTS Installation: Compatible and optimal version.
- ✓ Environment Variables:
ANDROID_HOMEandJAVA_HOMEassigned correctly. - ✓ Android SDK: Minimum components installed and recognized by
adb. - ✓ Expo CLI: SDK in sync with the React Native version declared in
package.json. - ✕ Cocoapods (Windows Warning): Successfully ignored if you are not developing for iOS on this workstation.

