Skip to main content
Glama
using-expo-cli.md5.65 kB
--- title: Migrate from React Native CLI to Expo CLI sidebar_title: Migrate to Expo CLI description: Learn how to migrate from React Native CLI (@react-native-community/cli) to Expo CLI for any React Native project. --- To migrate from React Native CLI (`npx @react-native-community/cli@latest 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. It is strongly recommended to use Expo CLI when using other Expo tools. It is required for many tools, such as EAS Update, Expo Router, and expo-dev-client, and other features may not work as well without it. ## 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: For a detailed installation guide, see [Install Expo modules](/bare/installing-expo-modules). ## Why Expo CLI instead of React Native CLI 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 Native DevTools](/debugging/tools/#debugging-with-react-native-devtools). - [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`](/router/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-optional). - [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`: 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. ## Common questions 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. Yes! Refer to the [Customized Prebuild Example repository](https://github.com/byCedric/custom-prebuild-example) for more information. ## 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="Adopt Prebuild" description={ <> Automate your native directories using the app.json. </> } href="/guides/adopting-prebuild" Icon={BookOpen02Icon} />

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jaksm/expo-docs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server