Skip to main content

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 use create-expo-app with the default template:
This automatically sets up Expo Router with all required dependencies.

Manual Installation

If you have an existing Expo project, install Expo Router and its dependencies:

Required Dependencies

Expo Router requires these peer dependencies:

Optional Dependencies

For additional navigation features:

Project Setup

1. Update Entry Point

Modify your package.json to use Expo Router’s entry point:
package.json

2. Add Expo Router Plugin

Update your app.json or app.config.js:
app.json
For 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 in tsconfig.json:
tsconfig.json

4. Configure Metro Bundler

Create or update metro.config.js:
metro.config.js

5. Clear Cache

After installation, clear the Metro bundler cache:

Project Structure

Create the app directory in your project root:

Verify Installation

Create a simple layout and index file to verify everything works:
app/_layout.tsx
app/index.tsx
Start your development server:
Press i for iOS simulator, a for Android emulator, or w for web.

Platform-Specific Setup

iOS

For iOS, run:
Or if using Expo Go:

Android

For Android:

Web

For web development:

Troubleshooting

Metro Bundler Issues

If you encounter caching issues:

Type Errors

If TypeScript doesn’t recognize routes:
Expo Router generates types automatically when the dev server starts.

Deep Linking Not Working

Ensure your scheme is set in app.json:
app.json

React Native Screens

If navigation isn’t working properly:
  1. Ensure react-native-screens is installed
  2. For bare React Native apps, follow the react-native-screens installation guide
  3. Rebuild your app after installing native dependencies

Next Steps

Quick Start

Build your first app with Expo Router

File-Based Routing

Learn routing conventions