How to downgrade to a lower Expo SDK version

Sometimes people want to downgrade to a lower SDK version. For example, if you are using SDK 19 and you decide you want to use SDK 17.

In general, I don’t advise this. Each successive SDK adds more features, bug fixes, and performance improvements. But occasionally, you may want to downgrade to match the version of React Native in another project, or because there is a bug introduced in a new version of the SDK/React Native that you want to avoid, or for some other reason where you are sure you know what you are doing.

The steps you need to take for this are:
(1) Update the version of "react-native" listed in your package.json file.

It’s the line that looks like this:

    "react-native": "https://github.com/expo/react-native/archive/sdk-19.0.0.tar.gz",
  },

You can find a complete list of the releases of react-native for Expo SDKs here:

You’ll want to choose one that starts with sdk-, typically the most recent release of the SDK version that you are interested in. For example, if you want to use SDK 18, then you would look through the list of releases and see that sdk-18.0.3 is the most recent release.

Once you pick a release from that page, right click the “tar.gz” link and copy the URL for it so you get something like
https://github.com/expo/react-native/archive/sdk-18.0.3.tar.gz

Set the "react-native" version in your package.json to this URL.

So your package.json would look something like this:

  "dependencies": {
    "@expo/samples": "^2.0.2",
    "expo": "^19.0.0",
    "react": "16.0.0-alpha.12",
    "react-native": "https://github.com/expo/react-native/archive/sdk-18.0.3.tar.gz",
    "react-navigation": "^1.0.0-beta.12"
  },

You’ll also need to update the "expo" and "react" versions.

(1b) For "expo", run

npm show expo versions

from the shell, and find the most recent one that corresponds to the SDK version you are interested in. In this example (SDK18), it would be '18.0.9',

(1c) For react, we have to (i) figure out what version of React Native is used by the SDK version we are interested in, and then figure out what version of React that version of React Native corresponds to.

The easiest way to figure out what version of RN is used in an Expo SDK version is to check the release notes.

So, if you go look at the Expo blog at https://blog.expo.io/ and scroll back through the list of posts until you find the release notes for the version you’re looking for. For SDK 18, it’s this post:
https://blog.expo.io/expo-sdk-v18-0-0-is-now-available-38e62305283

… which mentions

Expo SDK 18.0.0 is based off the recently released React Native 0.45, “May”.

Then if you follow the links to the source code for that release on Github, you’ll see that it has a peer dependency for "react" of 16.0.0-alpha.12. (I got that from https://github.com/facebook/react-native/blob/v0.45.1/package.json )

(1d) Now that we’ve updated package.json, either yarn again or npm install (depending on which tool you use). To be safe, you might want to rm -rf node_modules before.

(2) Now we edit app.json (or exp.json if that’s what your project uses). Update the "sdkVersion" key to the one you want. So, something like

"sdkVersion": "18.0.3",

(3) Then close the project in XDE (or CRNA or exp) and restart it. And it should work!

Though there’s a decent chance you’ll have to update some application code if you’re going back very far in versions or using certain kinds of libraries.

(4) If you’ve published projects using Expo publishing, our code delivery system currently assumes that you want to use the latest version published against the most recent SDK you’ve used (this lets you push bug fixes to people who are on an old version of the binary of your app in a sane way).

So for some use cases, you may need to clear out the versions of your published project that run against the newer SDK. We don’t have an interface for doing that yet, so e-mail support with the information about what version you are downgrading to and which project and which user you are and any other relevant information to support@expo.io and we can fix that for you.

We hope to make an interface for this soon.

Again, in general, I don’t advise doing this, but if you know you what you are doing and are sure you want to do this, hopefully this guide is helpful.

Also, note that this was written in August 2017 and may become out of date.

1 Like

My project was running on expo version 43.0.1, I accidently upgraded it to 45. Build does not support the upgraded version. How can I safely downgrade it to 43.0.1?

1 Like

Ideally you would use git to revert to what you had before you upgraded. If for some reason you can’t do that, try:

expo upgrade 43
1 Like

Same here, I needed to let my current users know there is new update in app store to update to new version. Did you find anything?

Run: expo upgrade 41 or whatever SDK version you want to downgrade to, like I said.

But it would be better to create a git branch from before you upgraded and make your change there. Then switch back to your current branch afterwards.

Thanks for following up. I did run expo uprgrade 44, expo install and reinstalled necessary packages and then expo publish, it showed the warning » ios: Expo.plist key: "EXUpdatesSDKVersion": EXUpdatesSDKVersion is inferred to be "44.0.0", but it is set to "45.0.0". then I deleted the ios folder which removed warning but it really ruined the app which made it run in a very old version (1 week old) which I couldn’t to fix it.

Now 10-15 of my users ended up with much older and buggier version of app and I couldn’t do anything about it except letting them know to update newer version from App Store by emailing only few of them who has emails.

OK, so your app was technically a “bare workflow” app, rather than a managed app. If this was not intended then I suspect you ran expo run:ios at some point.

Please see the following for some more information:

As for exactly what happened or why your users somehow got an old version of the app, I’m not entirely sure, but expo upgrade cannot, of course, somehow revert your JavaScript code. Maybe you could verify that the code is correct and then publish again?

I think the safest way to have done this would have been something like this:

  • Find the latest Git commit that was done on SDK 44, before you upgraded to SDK 45. (Preferably the latest SDK 44 version you published.)
  • Create a Git branch at that commit and check it out
  • Make sure you don’t have android and ios directories
  • Make your change there to notify your users of the new version and commit it to the new branch
  • Publish the app
  • Switch back to your main development branch