npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2026 – Pkg Stats / Ryan Hefner

react-native-device-runner

v1.0.10

Published

πŸš€ Auto device detection & React Native/Expo app runner script

Readme

React Native Device Runner

Automatically detects connected physical devices and runs your React Native or Expo app with a single command. Works seamlessly with both Expo and React Native CLI projects.

πŸ“‹ Requirements

iOS

  • Xcode 15+ (recommended)
  • Connected iOS device (Developer Mode enabled)
  • Device trusted in Xcode

Android

  • Android SDK installed
  • adb command available
  • USB debugging enabled on device

Common

  • Node.js & npm or pnpm
  • For Expo projects: Expo SDK installed
  • For React Native CLI projects: React Native CLI installed
  • jq (optional, for advanced JSON parsing)

πŸš€ Installation & Usage

Method 1: Run directly with npx (Recommended)

# Auto-detect (iOS preferred)
npx react-native-device-runner

# Prefer Android
npx react-native-device-runner --prefer android

# Prefer iOS
npx react-native-device-runner --prefer ios

# Help
npx react-native-device-runner --help

# Version
npx react-native-device-runner --version

Method 2: Global Install

npm install -g react-native-device-runner

# Usage after install
rn-device
# or
rndr
# or
react-native-device-runner

βš™οΈ Configuration

You can configure build options using one of the following methods:

Note: The tool automatically uses Debug for iOS configuration and debug for Android variant - these values are hardcoded and don't need to be configured.

1. app.json extra section (Expo projects)

{
  "expo": {
    "extra": {
      "IOS_SCHEME": "myapp",
      "IOS_BUNDLE_ID": "com.mycompany.myapp",
      "AOS_APP_ID": "com.mycompany.myapp"
    }
  }
}

2. .env file

IOS_SCHEME=myapp
IOS_BUNDLE_ID=com.mycompany.myapp
AOS_APP_ID=com.mycompany.myapp

3. Environment variables

export IOS_SCHEME="myapp"
export IOS_BUNDLE_ID="com.mycompany.myapp"
npx react-native-device-runner

4. Force project type

If automatic detection fails or you need to override:

# Force Expo mode
export FORCE_PROJECT_TYPE="expo"
npx react-native-device-runner

# Force React Native CLI mode
export FORCE_PROJECT_TYPE="react-native-cli"
npx react-native-device-runner

🎯 Example Usage

$ npx react-native-device-runner

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                πŸš€ React Native Device Runner                          β”‚
β”‚              Auto Device Detection & Runner Script                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

## πŸ“ Configuration Variables

| Variable            | Description             | Default      | Example                 |
| ------------------- | ----------------------- | ------------ | ----------------------- |
| `IOS_SCHEME`        | iOS build scheme        | -            | `myapp`                 |
| `IOS_BUNDLE_ID`     | iOS bundle ID           | -            | `com.mycompany.myapp`   |
| `IOS_WORKSPACE`     | iOS workspace path      | -            | `ios/MyApp.xcworkspace` |
| `IOS_DERIVED_DATA`  | iOS build data path     | `.build/ios` | `.build/ios`            |
| `AOS_APP_ID`        | Android app ID          | -            | `com.mycompany.myapp`   |
| `AOS_MODULE`        | Android module name     | `app`        | `app`                   |

> **Note:** The tool automatically uses `Debug` for iOS configuration and `debug` for Android variant. These values are hardcoded and don't need to be configured.

## Project Type Detection

React Native Device Runner automatically detects whether your project is using Expo or React Native CLI based on several factors:

1. **Package Dependencies**: Checks if `expo` is listed in your package.json dependencies
2. **Configuration Files**: Looks for Expo-specific files like app.json with an expo section
3. **Directory Structure**: Checks for the presence of ios/ and android/ folders
4. **Command Availability**: Verifies that the necessary CLI tools are installed

The tool will optimize the build and run commands based on the detected project type. If automatic detection fails, it defaults to React Native CLI mode.

## 🚫 Troubleshooting

### Metro/Expo compatibility errors

If you encounter errors related to Metro bundler or Expo CLI internals like:

- `Package subpath './src/lib/TerminalReporter' is not defined by 'exports'`
- `Cannot find module 'metro/src/lib/TerminalReporter'`

Try one of these solutions:

1. Force React Native CLI mode:

```bash
export FORCE_PROJECT_TYPE="react-native-cli"
npx react-native-device-runner
  1. Run with the --no-bundler option (for Expo projects):
npx expo run:ios --device YOUR_DEVICE_ID --no-bundler
npx expo run:android --device YOUR_DEVICE_ID --no-bundler
  1. Update your Metro and Expo dependencies to compatible versions:
npx expo install metro metro-resolver

Note: The tool automatically uses Debug build configuration for iOS and debug variant for Android - you don't need to specify these values.

iOS device not detected

  • Check device trust settings in Xcode
  • Make sure the device is trusted
  • Check device status in Xcode > Window > Devices and Simulators

Android device not detected

  • Make sure USB debugging is enabled
  • Check device connection with adb devices
  • Try a different USB cable or port

Expo/React Native config not loading

  • Test with npx expo config --json (for Expo)
  • Make sure your config files are valid JSON
  • Install jq if needed: brew install jq (macOS) or apt install jq (Ubuntu)

πŸ“„ License

This project is licensed under the MIT License. See LICENSE for details.