Β· hands on

Upgrading Expo in a React Native Project with TypeScript

Upgrade Expo in your TypeScript React Native project with ease. Check your versions, update the main Expo dependency, sync and fix others, and patch vulnerabilities β€” all in one streamlined process.

Expo is a powerful framework for building React Native applications. Staying current with your Expo project ensures you get the latest features, performance boosts, and essential security patches. This guide will show you how to effortlessly upgrade Expo in a TypeScript-based React Native project.

Before upgrading, it’s essential to know the current versions of Expo, React Native, and other dependencies your project is using. Open package.json and note these versions. Refer to the Expo Changelog notes for details on breaking changes and migration guides.

I recently tried to update my Expo app using expo upgrade but I received the following message:

expo upgrade is not supported in the local CLI, please use expo-cli upgrade instead

I then tried npx expo-cli upgrade but it gave me the same message. So, I referred to the official Expo documentation on upgrading the SDK and figured out the necessary steps:

  1. First, run npm install expo@latest to upgrade your main "expo" dependency to the latest production version available.
  2. Next, run npx expo install --fix to update all dependencies based on Expo, such as "expo-dev-client", "expo-apple-authentication", "expo-build-properties,", "expo-constants", etc.
  3. Then, run npm update --save to update all other dependencies, such as "@shopify/restyle", "axios", etc. and save the updated versions in the package-lock.json file (due to the update command) and the package.json file (due to the --save option).
  4. Finally, run npm audit fix to update all vulnerable packages that come from transitive dependencies.
  5. To ensure your app is correctly configured with the upgraded Expo SDK, run npx expo-doctor.

By following the steps listed above, I was able to upgrade Programming Tutorials for Android and Programming Tutorials for iOS.

Back to Blog