10

How do you specify the expo version when creating a project? Such as in React Native you can just add the version in the command like this react-native init projectName --version@0.60.0

What about in expo init projectName ?

Eaten Taik
  • 868
  • 2
  • 12
  • 35

2 Answers2

15

There is no way to specify react native version in expo cli. But you can specify SDK version in expo cli. Each SDK corresponds to particular react native version you can find the react native version for the expo sdk here(https://github.com/expo/react-native/releases)

For example, if you want to work with react native 0.61.4, you can use expo sdk-37.0.1

expo init --template expo-template-blank@sdk-37.0.1

EDIT as of now, it depends on how you start your package manager.

npm create-expo-app [name] --template blank@45
yarn create-expo-app [name] --template blank@45
pnpm create-expo-app [name] --template blank@45
npx create-expo-app [name] --template blank@45

Unfortunately there's no nice way of doing an npm search but the pattern for the template is anything that starts with expo-template is a potential candidate. The author you'd be looking for is brentvayne from Expo team. Reference:

  1. https://github.com/expo/react-native/releases
  2. https://docs.expo.io/workflow/upgrading-expo-sdk-walkthrough/?redirected
  3. https://github.com/expo/expo-cli/issues/142
sakshya73
  • 5,570
  • 5
  • 22
  • 41
Jiffin
  • 405
  • 5
  • 8
  • And I guess if someone needs ejected version with ios and android folders then need to eject also. – Alexander Danilov Jan 12 '23 at 13:39
  • Expo and React-Native major versions have a 1:1 mapping, so there is a way to specify the React-Native major version - by specifying the equivalent Expo major version. – Karatekid430 Jan 27 '23 at 02:17
  • You might want to replace `[npm|yarn|pnpm] create-expo-app` with `[npm|yarn|pnpm] create expo-app` (I tried `yarn create-expo-app` but it doesn't work, as of 2023) – Benito Apr 20 '23 at 16:09
3

Mapping between React Native CLI versions and Expo is here:

https://docs.expo.dev/versions/latest/

enter image description here

In my case, available template names were: "blank, tabs, bare-minimum"

So when you would run

npx create-expo-app -t tabs@45

It will ask you for the app name, and when finished, you would have the app boilerplate installed using Typescript, and React Navigation.

Stefan Majiros
  • 444
  • 7
  • 11