When developing with Expo, how you start your project dictates your entire debugging workflow. Whether you're testing on a physical device across the world or an emulator on your desk, understanding these options is key to a smooth developer experience.
1. Network Routing Flags
These flags in `npx expo start` control how the development server exposes your JavaScript bundle to your testing device.
1.1 `npx expo start --lan` (Local Area Network)
The default way to develop. It uses your computer’s internal IP address (e.g., 192.168.1.5). As long as your phone and laptop are on the same Wi-Fi, the connection is fast and stable. This won't work as-is when your development environment is WSL2 on Windows or a Docker Container; you will have to bridge the networking gap between your host and isolated dev environment.
I got this working with Ubuntu WSL2 on Windows connected to my Android phone over USB port. If your deployment mode is purely by leveraging Expo Go app, then check out my blog post that I had authored earlier when I migrated to Expo for RN development from native Android development. When you go beyond using Expo components to start using native RN one, you can't rely on Expo Go app on your mobile phone, but would want to leverage native ADB (Android Debugging Bridge) for debugging and deploying your development builds into your phone device or emulators, the steps involved get a little more complicated in and I'll author a separate blog on how to do it in upcoming post.
1.2 `npx expo start --tunnel` (Internet / WAN)
Creates a secure proxy via a tool like Ngrok. This is a lifesaver when you are on corporate or university Wi-Fi with strict firewalls (where devices can't "see" each other) or if you need to show your progress to a remote teammate. It is significantly slower than local connections because every file transfer has to travel through an external server over the internet.
1.3 `npx expo start --localhost` (Loopback / Same host)
Restricts the server to your local machine (127.0.0.1). Use this exclusively for Simulators and Emulators running on the same computer. Physical devices cannot connect via this flag, because it sees "localhost" as itself, not your computer.
2. Platform & Environment Flags
2.1 `npx expo start --dev-client`
Standard Expo Go is great, but once you add custom native code or unique config plugins, you need a Development Build. Adding this flag tells Expo to serve the bundle for your custom-built app instead of the default Expo Go environment.
2.2 `npx expo start --web`
This starts the development server specifically for the browser. It opens your project in a new tab, allowing you to debug responsive layouts and web-specific features instantly.
3. Native Execution Commands
Sometimes serving JavaScript isn't enough; you need to compile the actual native project code.
3.1 `npx expo run:android`
This command does the heavy lifting. It generates the android directories (prebuild), compile the native code using Gradle, and then install the resulting app onto a connected device or emulator. Use it when you've added a library that requires native linking or when you need to test the "bare" workflow.
