react-nativeexpo

Expo project error Could not connect to development server after updating expo SDK


I created a project a while back and tried running it recently and got an error from expo saying that my SDK version is not up to date. So I followed this answer (The experience you requested uses Expo SDK v(null), but this copy of Expo Client requires at least v23.0.0) to fix it. However now I'm running into a new error where my project cannot run and I get this error:

Could no connect to development server

What can I do to fix this? I don't want to try a hundred different solutions and accidentally lose my project forever and have to start over, so I figured I'd ask on here.

Here is my package.json:

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject"
  },
  "dependencies": {
    "axios": "^0.19.0",
    "expo": "^33.0.0",
    "firebase": "^6.5.0",
    "formik": "^1.5.8",
    "global": "^4.4.0",
    "native-base": "^2.12.1",
    "react": "16.5.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
    "react-native-elements": "^0.18.5",
    "react-native-keyboard-aware-scroll-view": "^0.9.1",
    "react-native-modal": "^11.3.1",
    "react-native-paper": "^2.16.0",
    "react-native-smart-carousel": "^1.1.0",
    "react-native-snap-carousel": "3.6.0",
    "react-native-vector-icons": "^6.6.0",
    "react-navigation": "^3.11.0",
    "styled-components": "^4.2.0",
    "truffle": "^5.0.34",
    "uuid": "^3.3.3",
    "web3": "0.19"
  },
  "devDependencies": {
    "babel-preset-expo": "^5.0.0"
  },
  "private": true
}

I ran expo-cli --version in my terminal and this is what I received:

3.0.4

Thank you


Solution

  • Please follow these steps:

    1. Run npm install -g expo-cli to install the latest Expo CLI globally.
    2. Close your Expo CLI server if you are using it.
    3. Make sure in app.json the sdkVersion is 33.0.0
    4. Change the react dependency in your package.json from 16.5.0 to 16.8.3
    5. Delete your project node_modules directory and package-lock.json file
    6. Run npm install or yarn install depending on your package manager.
    7. Run expo start -c to clear your cache and start your application.

    Bonus

    Now for any Expo based API or dependency you can install it by using expo install instead of npm install i.e. expo install @expo/vector-icons. This is better than using the traditional npm install or yarn install as it will install the version of the dependency that's compatible with your current Expo SDK.

    Hope this Helps!