Build failure due to react dependency loop when upgrading to Expo SDK 48.

We have a app created using expo with dependencies as follows:

  "dependencies": {
    "apollo-client": "^2.6.0-rc.3",
    "aws-amplify": "^1.1.29",
    "aws-amplify-react-native": "^2.2.2",
    "aws-appsync": "^1.7.1",
    "aws-appsync-react": "^1.2.6",
    "aws-sdk": "^2.478.0",
    "axios": "^0.19.0",
    **"expo": "^34.0.1"**,
    "graphql": "^0.13.0",
    "moment": "^2.24.0",
    "react": "16.8.3",
    "react-apollo": "^2.5.6",
    "react-dom": "^16.8.6",
    "react-moment": "^0.9.2",
    "react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
    "react-native-fs": "^2.13.3",
    "react-native-gesture-handler": "^1.0.15",
    "react-native-modal-datetime-picker": "^6.0.0",
    "react-native-modalbox": "^1.6.0",
    "react-native-paper": "^2.4.0",
    "react-native-sound": "^0.10.12",
    "react-native-voice": "^0.2.6",
    "react-navigation": "^3.0.9"
  },

We changed “expo” version to 48 and “react-native” to https://github.com/expo/react-native/archive/sdk-48.0.0.tar.gz. The version of “react” acceptable to the AWS libraries is 16 while “expo/react-native/archive/sdk-48.0.0.tar.gz” needs 18. This is causing a dependency loop between versions which is not being resolved.

Please could you suggest the versions of the libraries that work with each other correctly. Thank you.

  • Do not use fork https://github.com/expo/react-native, you should use regular upstream react-natvei (npx expo install react-native)
  • Use npx expo install <package> to install packages, It will pick compatible version for your sdk. Note that it only works for expo packages and some rn packages, most third party rn libraries are not supported and expo install will just run yarn install/npm install
  • You can try using npx expo upgrade
  • Make sure to check npx expo-doctor output after upgrading to make sure everything is compatible.
  • Sdk 34 is very old, upgrading it might not be that easy, some packages that you are using might not be maintained anymore. It might be easier to create new expo app and move your code there.

The version of “react” acceptable to the AWS libraries is 16 while “expo/react-native/archive/sdk-48.0.0.tar.gz” needs 18

seems like you need to update aws libraries.

So the answer is to rewrite the app using Expo or something else as AWS and Expo don’t work together due to differing versions of react required by the libraries and due to deprecated libraries. Thank you.

Hi @nikhilramabhadra

In addition to what wkozyra said, you should read through the Expo SDK release blog posts from Expo SDK 35 and Expo SDK 48 to see what was deprecated so that you can make the necessary changes to your code. (See the bottom of this comment for a list of them.)

You don’t have react-native-web installed, so you don’t need react-dom

So this is a Bare workflow app? If you want to switch to the Managed workflow, you can still use react-native-fs, but you will not be able to use Expo Go. Instead, you can create a development build and use that.

If you run expo-cli doctor you it might complain about react-native-gesture-handler depending on which version you actually have installed:

Some dependencies are incompatible with the installed expo package version:
 - react-native-gesture-handler - expected version: ~1.3.0 - actual version installed: 1.10.3

If you do decide to give expo-cli upgrade a try, you’ll see something like this:

đź‘Ź Automated upgrade steps complete.
...but this doesn't mean everything is done yet!

âś… The following packages were updated:
react, react-dom, react-native, react-native-gesture-handler, babel-preset-expo, expo

🚨 The following packages were not updated. You should check the READMEs for those repositories to determine what version is compatible with your new set of packages:
apollo-client, aws-amplify, aws-amplify-react-native, aws-appsync, aws-appsync-react, aws-sdk, axios, graphql, moment, react-apollo, react-moment, react-native-fs, react-native-modal-datetime-picker, react-native-modalbox, react-native-paper, react-native-sound, react-native-voice, react-navigation

As it says you should check for up to date versions of those dependencies and how to upgrade them. e.g. React Navigation changed quite a bit between version 3 and the current version.

No, I don’t believe this is correct. The AWS Amplify documentation seems to be up to date with recent versions of Expo, so you probably just need to update the aws-* dependencies to recent versions.

Expo SDK release blog posts:

If I install your dependencies and then upgrade to Expo SDK 48 I get the following dependencies:

  "dependencies": {
    "apollo-client": "^2.6.0-rc.3",
    "aws-amplify": "^1.1.29",
    "aws-amplify-react-native": "^2.2.2",
    "aws-appsync": "^1.7.1",
    "aws-appsync-react": "^1.2.6",
    "aws-sdk": "^2.478.0",
    "axios": "^0.19.0",
    "expo": "^48.0.0",
    "expo-dev-client": "~2.1.6",
    "expo-status-bar": "~1.4.4",
    "graphql": "^0.13.0",
    "moment": "^2.24.0",
    "react": "18.2.0",
    "react-apollo": "^2.5.6",
    "react-moment": "^0.9.2",
    "react-native": "0.71.6",
    "react-native-fs": "^2.13.3",
    "react-native-gesture-handler": "~2.9.0",
    "react-native-modal-datetime-picker": "^6.0.0",
    "react-native-modalbox": "^1.6.0",
    "react-native-paper": "^2.4.0",
    "react-native-sound": "^0.10.12",
    "react-native-voice": "^0.2.6",
    "react-navigation": "^3.0.9"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0"
  },

If I then run yarn outdated I get the following:

(npm outdated should give you something similar)

This should give you an idea of what probably needs to be updated. But don’t just blindly upgrade to the versions shown here. e.g. React Navigation is now up to version 6.x, but in order to upgrade to that version you would need to uninstall the react-navigation package and install the packages specified in their documentation instead (and then make the necessary changes to the code).

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.