Eaten Taik
Eaten Taik

Reputation: 938

Create an expo project with a specific version

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 [email protected]

What about in expo init projectName ?

Upvotes: 15

Views: 15015

Answers (3)

FredG
FredG

Reputation: 869

To add info to the accepted answer, and tags were changed on expo-template-blank (I have No matching version found for [email protected].)

What I found to be working :

  • expo init --template [email protected]
  • expo init --template expo-template-blank@sdk-37 for the latest sdk-37

To have an idea of current tags/branches and react-native dependency, I found this to be used internally by expo-cli:

npx pacote packument expo-template-blank |jq .

Note that for sdk <= 42, they would use their own repo and tag for react-native, making a pain to find a particular legacy version. You need to check manually in their repo for the actual react-native base version at https://github.com/expo/react-native

I extracted it for you :

git clone https://github.com/expo/react-native
cd react-native
for ((i=10; i<50; ++i)); do RN_VERSION=$(git cat-file  blob origin/sdk-$i:package.json|sed '/"version"/!d; s/.*: "\(.*\)",/\1/'); echo "sdk-$i => $RN_VERSION"; done
expo sdk version => react-native branch version
sdk-10 => 0.33.0
sdk-11 => 0.36.0
sdk-12 => 0.37.0
sdk-13 => 0.40.0
sdk-14 => 0.41.2
sdk-15 => 0.42.0
sdk-16 => 0.43.2
sdk-17 => 0.44.0
sdk-18 => 0.45.1
sdk-19 => 0.46.1
sdk-20 => 0.47.1
sdk-21 => 0.48.4
sdk-22 => 0.49.3
sdk-23 => 0.50.4
sdk-24 => 0.51.0
sdk-25 => 0.52.0
sdk-26 => 0.54.2
sdk-27 => 0.55.2
sdk-28 => 0.55.4
sdk-29 => 0.55.4
sdk-30 => 0.55.4
sdk-31 => 0.57.1
sdk-32 => 0.57.1
sdk-33 => 0.59.8
sdk-34 => 0.59.8
sdk-35 => 0.59.8
sdk-36 => 0.61.4
sdk-37 => 0.61.4
sdk-38 => 0.62.2
sdk-39 => 0.63.2
sdk-40 => 0.63.2
sdk-41 => 0.63.2
sdk-42 => 0.63.2
sdk-43 => 0.64.3
sdk-44 => 0.64.3
sdk-45 => 0.68.1
sdk-46 => 0.69.1
sdk-47 => 0.70.3
sdk-48 => 0.71.13
sdk-49 => 1000.0.0

Upvotes: 0

Stefan Majiros
Stefan Majiros

Reputation: 584

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.

Upvotes: 3

inam
inam

Reputation: 533

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 [email protected]

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

Upvotes: 28

Related Questions