What's the significance of using the "local" CLI

I’m a bit confused about the relationship between using the local cli and using the global one. Two kinds of confusion actually:

  1. When there’s a command that both support like install what’s the difference between running the local (with yarn expo install) and the global (with expo or expo-cli)?

  2. When the only way to run a command is to run global, what’s going on? E.g., does expo doctor still work as it always did?

All in all I’m not at all clear why there are now sometimes two ways of doing what looks like the same thing, and sometimes no way (without going global), or why it’s so easy to accidentally go global when that’s not what’s intended (e.g. forgetting to prepend yarn to expo).

What am I missing?

Hey @orome,

The Local CLI is the new CLI that comes pre-packaged when Expo SDK is used in a new project (starting from SDK 46). We are currently moving away from Global CLI in favor of local CLI. This means that the npx expo command can be used in any React Native project that includes Expo SDK (for example, with custom development clients too).

You can find more info about the local cli in the docs: https://docs.expo.dev/workflow/expo-cli/. There are also some added benefits that were discussed in the release announcement of the local CLI post: The New Expo CLI. In Expo SDK 46 we introduced a new… | by Evan Bacon | Exposition. Few of the major highlights was to make it fast, make it work well in case using CI (Continuous Integration), and so on.

Yes, there are some options like doctor that still use Global CLI but in the local CLI you will find the option to validate version and fix using --check and --fix options. Here is the documentation for that: https://docs.expo.dev/workflow/expo-cli/#version-validation

The --check option now also enables to check version incompatibility for specific packages included in a project.

1 Like