Expo SDK upgrading to SDK 47 not possible

Please provide the following:

  1. SDK Version: ^47.0.0
  2. Platforms(Android/iOS/web/all): in Theory All but mainly Android

I cant upgrade my Expo SDK - trying to upgrade from SDK 44 to SDK 47.

I ran the npm i expo-cli command and got the newest Version.

When I type expo --version I get:

6.0.8

I update my NodeJS to the newest LTS Version because I read that that can cause problems.

However when I run: expo-cli upgrade I get:

Cannot determine which native SDK version your project uses because the module expo is not installed. Please install it with yarn add expo and try again.

Same with expo doctor!

Trying to start the project with npm start gives me:

Unable to find expo in this project - have you run yarn / npm install yet?

I noticed that my “Node Modules” Folder also went missing so I ran npm install and got back this:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: react-native-gesture-handler@2.8.0
npm ERR! node_modules/react-native-gesture-handler
npm ERR!   react-native-gesture-handler@"~2.8.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-gesture-handler@"^1.0.12" from react-navigation-drawer@2.7.2
npm ERR! node_modules/react-navigation-drawer
npm ERR!   react-navigation-drawer@"~2.7.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Dev\npm\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Dev\npm\npm-cache\_logs\2022-11-23T10_08_32_071Z-debug.log

I also get the same log when I try to: npm install expo again.

Does anyone have a fix for this behavoir/some guidance for the upgrade?

FYI my package.json (changed the gesture-handler from 2.8.0 to 2.1.0 - what it was before):

  "dependencies": {
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-native-community/datetimepicker": "6.5.2",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-picker/picker": "2.4.8",
    "expo": "^47.0.0",
    "expo-print": "~12.0.0",
    "expo-sharing": "~11.0.1",
    "expo-updates": "~0.15.6",
    "md5": "^2.2.1",
    "moment": "^2.24.0",
    "moment-business": "^3.0.1",
    "react": "18.1.0",
    "react-dom": "18.1.0",
    "react-native": "0.70.5",
    "react-native-animatable": "^1.3.2",
    "react-native-elements": "^2.1.0",
    "react-native-gesture-handler": "~2.1.0",
    "react-native-reanimated": "~2.12.0",
    "react-native-safe-area-context": "4.4.1",
    "react-native-screens": "~3.18.0",
    "react-native-vector-icons": "^6.6.0",
    "react-native-web": "~0.18.7",
    "react-navigation": "^4.0.10",
    "react-navigation-drawer": "~2.7.1",
    "react-navigation-stack": "~2.10.4",
    "react-navigation-tabs": "~2.11.1"
  }

Hi @yesiamfaded

Try running npm install --legacy-peer-deps

Then run: expo-cli doctor --fix-dependencies
and: npx expo install --check

1 Like

Yeah I did that - it reinstalled my node_modules, however when I run expo-cli upgrade it deletes it again.

There should be no need to run expo-cli upgrade again after that, because your dependencies already have you on expo SDK version 47.

But there’s something seriously strange going on if expo-cli upgrade deletes your node_modules! I have never seen that happen and don’t know how it would be possible unless you have some weird post-install script.

As far as I know expo-cli upgrade just figures out what versions of packages to install and then calls npm (or yarn) to do the work.

Is your app by any chance in a monorepo?
Do you have a package.json in a parent (or grandparent etc.) directory?

Package-lock,json is there where it should be. 3 Months ago I stopped working on the App and I wanted to continue by upgrading the SDK :smiley: After the successfull npm install I can run npm start.

It starts the Metro Bundler and then when I want to open it on my Emulator - so by pressing “a” it tells me:

Failed to resolve the Android SDK path. Default install location not found: C:\Users\xxx\AppData\Local\Android\Sdk. Use ANDROID_HOME to set the Android SDK location.

And also that it could not find the command “abd”. However I did not change anything my ANDROID_HOME var is still set to what it should be. Is there any fix for this? Did something change on how the Metro Bundler picks up the Emulator or something?

hmmm… not sure.

I have the ANDROID_SDK_ROOT environment variable set to where I have it installed, which for me is /home/username/Android/Sdk

I do not have ANDROID_HOME set.

Also, for me, adb is in the platform-tools subdirectory.

What do you get if you set ANDROID_SDK_ROOT to where the SDK is installed for you and then do this?

C:\>dir %ANDROID_SDK_ROOT%\platform-tools\adb.*

Does setting the above environment variable get it working for you?

Yes it finds me this:

Verzeichnis von C:\Dev\Programme\Android\Sdk\platform-tools

23.11.2022 11:57 5.992.960 adb.exe
1 Datei(en), 5.992.960 Bytes
0 Verzeichnis(se), 20.920.086.528 Bytes frei

So I think that it finds the abd if I am reading that right

1 Like

Okay I had to restart my PC maybe it has something to do with the NodeJS update - eventhough it was already showing the newest version. Got Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE] now what I am trying to fix now.
– fixed

Thanks @wodin

1 Like

thank you! this worked for me.

1 Like