1--- 2title: Using Expo CLI 3description: Learn how and why you can use Expo CLI instead of @react-native-community/cli in any React Native project. 4--- 5 6import { Terminal } from '~/ui/components/Snippet'; 7import { Collapsible } from '~/ui/components/Collapsible'; 8import { BoxLink } from '~/ui/components/BoxLink'; 9 10To use Expo CLI in a project created with `npx react-native init`, you will first need to install the `expo` package. This package includes the Expo Modules API and Expo CLI. For a complete explanation of how to install this, see the ["Install Expo modules" guide](/bare/installing-expo-modules.mdx). For most apps, it's as simple as running the following command in your project directory: 11 12<Terminal cmd={['npx install-expo-modules@latest']} /> 13 14## Why Expo CLI instead of `npx react-native` 15 16Expo CLI commands provide a number of benefits over the similar commands in `@react-native-community/cli`, including: 17 18- You can open up the Hermes debugger in one keystroke: <kbd>j</kbd>. 19- The debugger ships with React Developer Tools (`react-devtools`) already installed. 20- Support for [Continuous Native Generation](/workflow/prebuild.mdx) (CNG) with `npx expo prebuild` for easy upgrades, white-labeling, simple third-party package setup, and improved maintainibility of your codebase (by reducing the surface area). 21- Support for file-based routing with [`expo-router`](https://expo.github.io/router/docs). 22- View native logs directly in the terminal alongside your JavaScript logs. 23- Improved native build log formatting by using Expo CLI's own `xcpretty`-style tool that is built specifically for React Native apps. For example, when compiling a Pod you can see which Node module included it. 24- [Automatic TypeScript support](/guides/typescript.mdx). 25- [Automatic web support](/guides/customizing-metro.mdx/#adding-web-support-to-metro) with Metro. 26- Out of the box [support for monorepos](/guides/monorepos.mdx). 27- Support for Expo tooling such as [expo-dev-client](/develop/development-builds/introduction.mdx), the [Expo Updates protocol](/technical-specs/expo-updates-1.mdx) and [EAS Update](/eas-update/introduction.mdx). 28- `npx expo run:ios` will invoke `pod install` automatically when needed. 29- `npx expo install` picks known compatible versions of dependencies for well-known packages. 30- `npx expo run:[android|ios]` and `npx expo start` automatically detect if an app is running on the default port and suggests another. 31- Select an Android or iOS device to launch into using <kbd>shift+i</kbd> or <kbd>shift+a</kbd> from the interactive prompt. 32- Built-in support for serving your app over an [ngrok tunnel](/develop/development-builds/development-workflows.mdx/#tunnel-urls), which is useful for testing on physical devices on restricted networks. 33 34We 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, Windows and macOS — if you are building for those platforms, you can use Expo CLI for the supported platforms and `@react-native-community/cli` for the others. 35 36## Compiling and running your app 37 38Once you have the `expo` package installed, you can use the `npx expo run:android` and `npx expo run:ios` commands as alternatives to `npx react-native run-android` and `npx react-native run-ios`. You can pass in the `--device` flag to select a device/simulator to build for — this also works for any connected iOS device. 39 40## Starting the bundler 41 42`npx expo run:[android|ios]` will start the bundler/development server. You can skip that by passing in `--no-bundler` flag. Start the development server independently with `npx expo start --dev-client`. 43 44## Common questions 45 46<Collapsible summary="Can I use Expo CLI without installing the Expo Modules API?"> 47 48When you install the `expo` package with `npx install-expo-modules`, you will also install the Expo Modules API. If you just want to try out Expo CLI for now, you can install the `expo` package with `npm install` and then configure your **react-native.config.js** to exclude the package from autolinking: 49 50```js 51module.exports = { 52 dependencies: { 53 expo: { 54 platforms: { 55 android: null, 56 ios: null, 57 macos: null, 58 }, 59 }, 60 }, 61}; 62``` 63 64Note that not all features will work without the Expo Modules API installed. For example, you will not be able to use the `expo-dev-client` package or `expo-router`. 65 66</Collapsible> 67 68<Collapsible summary="Can I use prebuild for out-of-tree platforms, such as Windows or macOS?"> 69 70Yes! Refer to the ["Customized Prebuild Example" repository](https://github.com/byCedric/custom-prebuild-example) for more information. 71 72</Collapsible> 73 74## Learn more 75 76With the `expo` package installed and configured in your project, you can start using all features from Expo CLI and SDK. 77 78<BoxLink 79 title="Expo CLI Reference" 80 description="Learn more about the commands and flags available in Expo CLI." 81 href="/more/expo-cli" 82/> 83<BoxLink 84 title="Adopting Prebuild" 85 description="Automate your native directories using the app.json." 86 href="/guides/adopting-prebuild" 87/> 88<BoxLink 89 title="Using the Expo SDK" 90 description="Try out modules from the Expo SDK in your app" 91 href="/versions/" 92/> 93<BoxLink 94 title="Try Expo Router" 95 description="Expo Router brings the best routing concepts from the web to native iOS and Android apps." 96 href="https://expo.github.io/router/docs/" 97/> 98