---
title: Migrate to Expo CLI
description: Learn how to migrate to use Expo CLI instead of @react-native-community/cli in any React Native project.
---

import { Terminal } from '~/ui/components/Snippet';
import { Collapsible } from '~/ui/components/Collapsible';
import { BoxLink } from '~/ui/components/BoxLink';
import { DEMI } from '~/ui/components/Text';

To migrate from `npx react-native init` to Expo CLI, you'll need to install the `expo` package which includes the Expo Modules API and Expo CLI. This guide covers the installation step, the benefits of using Expo CLI, and how to compile and run your project after migrating to Expo CLI.

## Install the `expo` package

In most cases, executing the following command in a project directory to install the package is all you need to do:

<Terminal cmd={['npx install-expo-modules@latest']} />

For a detailed installation guide, see [Install Expo modules](/bare/installing-expo-modules).

## Why Expo CLI instead of `npx react-native`

Expo CLI commands provide several benefits over the similar commands in `@react-native-community/cli`, which includes:

- Instant access to Hermes debugger with <kbd>j</kbd> keystroke.
- The debugger ships with React Developer Tools (`react-devtools`) already installed.
- [Continuous Native Generation (CNG)](/workflow/continuous-native-generation/) support with [`expo prebuild`](/workflow/prebuild/) for upgrades, white-labeling, easy third-party package setup, and better maintainability of the codebase (by reducing the surface area).
- Support for file-based routing with [`expo-router`](/routing/introduction/).
  - [Async bundling](/router/reference/async-routes) in development.
- Built-in [environment variable support](/guides/environment-variables) and **.env** file integration.
- View native logs directly in the terminal alongside JavaScript logs.
- Improved native build log formatting using Expo CLI's `xcpretty`-style tool built specifically for React Native apps. For example, when compiling a Pod, you can see which Node module included it.
- [First-class TypeScript support](/guides/typescript).
- Support for **tsconfig.json** aliases with `paths` and `baseUrl` [built-in to Metro](/guides/typescript#path-aliases).
- [Web support](/guides/customizing-metro/#adding-web-support-to-metro) with Metro. Fully typed for React Native Web.
- Modern [CSS support](/versions/latest/config/metro#css) with Tailwind, PostCSS, CSS Modules, SASS, and more.
- Static site generation with Expo Router and Metro web.
- Out of the box [support for monorepos](/guides/monorepos).
- Support for Expo tooling such as [`expo-dev-client`](/develop/development-builds/introduction), the [Expo Updates protocol](/technical-specs/expo-updates-1) and [EAS Update](/eas-update/introduction).
- Automated `pod install` execution when using `npx expo run:ios`.
- `npx expo install` selects compatible dependency versions for well-known packages.
- Automatic port detection when running `npx expo run:[android|ios]` and `npx expo start`. If another app is running on the default port, a different port is used.
- Android or iOS device launch selection shortcuts using <kbd>Shift</kbd> + <kbd>a</kbd> or <kbd>Shift</kbd> + <kbd>i</kbd> from the interactive prompt.
- Built-in support for serving your app over an [ngrok tunnel](/develop/development-builds/development-workflows/#tunnel-urls).
- Develop on any port with any entry JavaScript file.

We recommend Expo CLI for most React Native projects that target Android, iOS, and/or web. It does not yet have built-in support for the most popular out-of-tree platforms, such as
Windows and macOS. If building for these platforms, you can utilize Expo CLI for the supported platforms and `@react-native-community/cli` for the others.

## Compile and run your app

After installing the `expo` package, you can use the following commands which are alternatives to `npx react-native run-android` and `npx react-native run-ios`:

<Terminal cmd={['# for Android', 'npx expo run:android', '', '# for iOS', 'npx expo run:ios']} />

When building your project, you can choose a device or simulator by using the `--device` flag. This also applies to any iOS device that is connected to your computer.

## Start the bundler independently

`npx expo run:[android|ios]` automatically starts the bundler/development server. If you want to independently start the bundler with `npx expo start` command, pass the `--no-bundler` to the `npx expo run:[android|ios]` command.

> For SDK 48 and lower, use the `npx expo start --dev-client` command to start the bundler when using a development build or having `expo-dev-client` library installed in your project.

## Common questions

<Collapsible summary="Can I use Expo CLI without installing the Expo Modules API?">

Expo Modules API is also installed when you install the `expo` package with `npx install-expo-modules`. If you want to try out Expo CLI for now without installing Expo Modules API, install the `expo` package with `npm install` and then configure the **react-native.config.js** to exclude the package from autolinking:

```js react-native.config.js
module.exports = {
  dependencies: {
    expo: {
      platforms: {
        android: null,
        ios: null,
        macos: null,
      },
    },
  },
};
```

> **Note:** Without Expo API Modules installed, certain features such as `expo-dev-client` or `expo-router` are unavailable.

</Collapsible>

<Collapsible summary="Can I use prebuild for out-of-tree platforms, such as macOS or Windows?">

Yes! Refer to the [Customized Prebuild Example repository](https://github.com/byCedric/custom-prebuild-example) for more information.

</Collapsible>

## Next steps

Now, with the `expo` package installed and configured in your project, you can start using all features from Expo CLI and SDK. Here are some recommended next steps to dive deep:

<BoxLink
  title="Expo CLI Reference"
  description="Learn more about the commands and flags available in Expo CLI."
  href="/more/expo-cli"
/>
<BoxLink
  title="Adopt Prebuild"
  description={
    <>
      Automate your native directories using the <DEMI>app.json</DEMI>.
    </>
  }
  href="/guides/adopting-prebuild"
/>
<BoxLink
  title="Use Expo SDK"
  description="Try out libraries from the Expo SDK in your app."
  href="/versions/"
/>
<BoxLink
  title="Expo Router"
  description="Expo Router brings the best routing concepts from the web to native Android and iOS apps."
  href="/routing/introduction/"
/>
