Installation
This guide covers installing Expo Router and its required dependencies in your project.Prerequisites
- Node.js 18 or later
- Expo CLI
- An Expo project (SDK 52 or later recommended)
Automatic Installation
The easiest way to get started is to usecreate-expo-app with the default template:
Manual Installation
If you have an existing Expo project, install Expo Router and its dependencies:- npm
- yarn
- pnpm
Required Dependencies
Expo Router requires these peer dependencies:- npm
- yarn
- pnpm
Optional Dependencies
For additional navigation features:- npm
- yarn
Project Setup
1. Update Entry Point
Modify yourpackage.json to use Expo Router’s entry point:
package.json
2. Add Expo Router Plugin
Update yourapp.json or app.config.js:
app.json
app.config.js:
app.config.js
The
scheme is required for deep linking. Choose a unique scheme for your app.3. Modify TypeScript Config
If using TypeScript, extend the Expo Router TypeScript config intsconfig.json:
tsconfig.json
4. Configure Metro Bundler
Create or updatemetro.config.js:
metro.config.js
5. Clear Cache
After installation, clear the Metro bundler cache:Project Structure
Create theapp directory in your project root:
Verify Installation
Create a simple layout and index file to verify everything works:app/_layout.tsx
app/index.tsx
i for iOS simulator, a for Android emulator, or w for web.
Platform-Specific Setup
iOS
For iOS, run:Android
For Android:Web
For web development:Troubleshooting
Metro Bundler Issues
If you encounter caching issues:Type Errors
If TypeScript doesn’t recognize routes:Deep Linking Not Working
Ensure yourscheme is set in app.json:
app.json
React Native Screens
If navigation isn’t working properly:- Ensure
react-native-screensis installed - For bare React Native apps, follow the react-native-screens installation guide
- Rebuild your app after installing native dependencies
Next Steps
Quick Start
Build your first app with Expo Router
File-Based Routing
Learn routing conventions