Skip to content

React Native introduces doctor, a command to fix your dev environment

updated

The React Native Community has launched react-native doctor, a new CLI command meant to help developers get started, troubleshoot problems and automatically fix errors in their development environment. The command is the result of more than 20 pull requests from six contributors in the React Native Community.

According to the announcement, the command draws heavy inspiration from the doctor commands in Expo and Homebrew, with some of its UI modeled after Jest.

How it works

doctor currently checks most of the software and libraries React Native relies on, including CocoaPods, Xcode and the Android SDK. When it finds a problem, it offers to fix it automatically. If an issue cannot be resolved automatically, the command shows a message along with a link to instructions for fixing it manually.

Trying it out

The command is part of React Native 0.62, but it can be tried without upgrading by running it through the community CLI package:

npx @react-native-community/cli doctor

Supported checks

General checks:

  • Node.js (>= 8.3)
  • yarn (>= 1.10)
  • npm (>= 4)
  • Watchman (>= 4), which watches the filesystem for changes in development mode

Android-specific checks:

  • Android SDK (>= 26)
  • Android NDK (>= 19)
  • ANDROID_HOME, the environment variable required by the Android SDK setup

iOS-specific checks:

  • Xcode (>= 10)
  • CocoaPods, the dependency manager for iOS libraries
  • ios-deploy (optional), used internally by the CLI to install apps on a physical iOS device

Credits

The announcement credits the React Native Community for the work, specifically @thymikee, @thib92, @jmeistrich, @tido64 and @rickhanlonii.

Source: reactnative.dev