I cant upgrade my expo sdk to 39 and above stuck on expo 38, cant work on project after i upgraded the app

i have tried expo update, expo update 42.0.0 yet when i run my build it says upgrade to sdk 39 or above

  1. SDK Version: 38.0.0
  2. Platforms: Android/iOS

Does anyone know the cause of this issue so that i can finish this project

I would go SDK 38 to SDK 39, then SDK 40, then 41 and finally 42 rather than going straight to 42.

What output do you get if you run the following?

expo upgrade 39.0.0

This is what i got.

C:\Users\hp\Grocer-app-1-on-1-11-11-2020> expo upgrade 39.0.0
We couldn’t find a git repository in your project directory.
It’s recommended to back up your project before proceeding.

√ Would you like to proceed? … yes

We found an existing expo-cli instance running for this project and closed it to continue.

√ Would you like to upgrade the Expo app in the Android emulator? … yes

no devices connected
The upgrade of your Android client didn’t go as planned. You might have to reinstall it manually with expo
client:install:android.

Installing the expo@^39.0.0 package…
npm exited with non-zero code: 1
Error: npm exited with non-zero code: 1

I did this process but its still saying my sdk is 38 when i run expo Go. Even React native dependency shows

“react-native”: “https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz”,

It looks like npm is not working for some reason.

Just as a test, what happens if you create a new blank directory, change into that directory and run npm init, then accept all the defaults and then run npm install expo@^39.0.0 ?

By the way, you should probably use Git.

This is what i got after the instructions, apparently the new project is up to date

“expo”: “^39.0.0”,

"expo-status-bar": "~1.0.4",

"react": "16.13.1",

"react-dom": "16.13.1",

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

"react-native-web": "~0.13.12"

the project with issues is still showing:

“expo”: “^42.0.0”,

"expo-font": "~9.2.1",

"expo-status-bar": "^1.0.4",

"native-base": "^3.1.0",

"react": "~17.0.2",

"react-dom": "~17.0.2",

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

I just want to update the sdk to 42

Do you have your code in some form of version control?

If so, I suggest you roll back to just before you started trying to upgrade from SDK 38. At the moment your dependencies are mismatched.

Then see if trying to upgrade to SDK 39 works.

It might also help to remove your node_modules and reinstall them by running npm install before trying the upgrade again.

Alright after i clone the project again, what steps should i follow accordingly

The Github version:
@react-navigation/native”: “^5.7.3”,
@react-navigation/stack”: “^5.9.0”,
“expo”: “~38.0.8”,
“expo-font”: “~8.2.1”,
“expo-status-bar”: “^1.0.2”,
“native-base”: “^2.13.14”,
“react”: “~16.11.0”,
“react-dom”: “~16.11.0”,
“react-native”: “https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz”,
“react-native-bottomsheet-reanimated”: “0.0.22”,

OK, start off with:

expo upgrade 39.0.0

If it gives you an error, paste that here.
If the error is again something like the following:

then see what happens if you run that directly:

npm install expo@^39.0.0

and paste the output here.

This is what i got when i ran expo upgrade 39.0.0 :

Your git working tree is clean
To revert the changes after this command completes, you can run the following:
git clean --force && git reset --hard
√ You are already using the latest SDK version. Do you want to run the update anyways? This may be useful
to ensure that all of your packages are set to the correct version. … yes

√ Would you like to upgrade the Expo app in the Android emulator? … no

Validating configuration.
Updating your app.json to account for breaking changes (if applicable)…

Updating packages to compatible versions (where known).
Removing package-lock.json and deleting node_modules.
Installing node_modules and rebuilding package-lock.json.
Clearing the packager cache.

:clap: Automated upgrade steps complete.
…but this doesn’t mean everything is done yet!

:white_check_mark: The following packages were updated:
react-native-gesture-handler, react-native-reanimated, @react-native-community/masked-view, react-native-screens, expo-status-bar, react-native-safe-area-context, react-native, react, react-dom, react-native-web, babel-preset-expo, expo

:rotating_light: 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:
@react-navigation/drawer, @react-navigation/material-bottom-tabs, @react-navigation/native, @react-navigation/stack, react-native-paper, @babel/core

Please refer to the release notes for information on any further required steps to update and information
about breaking changes:

I ran expo upgrade 40.0.0 and this is what i got

Warning! Your git working tree is dirty.
It’s recommended to commit all your changes before proceeding, so you can revert the changes made by this command if necessary.

√ Would you like to proceed? … yes

√ Would you like to upgrade the Expo app in the Android emulator? … no

Installing the expo@^40.0.0 package…
Validating configuration.
Updating your app.json to account for breaking changes (if applicable)…

Updating packages to compatible versions (where known).
Updating packages to compatible versions (where known).
Updating packages to compatible versions (where known).
Removing package-lock.json and deleting node_modules.
Installing node_modules and rebuilding package-lock.json.
Clearing the packager cache.
Clearing the packager cache.

:clap: Automated upgrade steps complete.
…but this doesn’t mean everything is done yet!

:white_check_mark: The following packages were updated:
react-native-gesture-handler, react-native-screens, @react-native-community/masked-view,
expo-status-bar, react-native-safe-area-context, react-native-reanimated, react-native, react, react-dom, @babel/core, react-native-web, babel-preset-expo, expo

:rotating_light: 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:
@react-navigation/drawer, @react-navigation/material-bottom-tabs, @react-navigation/native, @react-navigation/stack, react-native-paper

Please refer to the release notes for information on any further required steps to update and information about breaking changes:

Then i ran expo start and this is the error message i got

C:\Users\hp\fruit delivery app\Grocer-app> expo start
› Port 19000 is
√ Use port 19001 instead? … yes
Starting project at C:\Users\hp\fruit delivery app\Grocer-app
Developer tools running on http://localhost:19003
Opening developer tools in the browser…
@react-native-community/masked-view” is added as a dependency in your project’s package.json but it doesn’t seem to be installed. Please run “yarn” or “npm install” to fix this
issue.

This does not make sense to me. It looks like you were already on SDK 42 before running expo upgrade 39.0.0

Anyway, after upgrading to SDK 39 you should ideally have upgraded any other dependencies if necessary, and taken care of any breaking changes mentioned in the SDK 39 blog post/changelog and made sure the app runs and your tests pass. Then you should commit that to Git.

Then when you upgraded to SDK 40 you would not have got the above warning.

This means your package.json is out of sync with your package-lock.json and/or what you have in node_modules. That would normally be because e.g. package.json was updated manually instead of using expo install ... or npm install ... or maybe something was removed from node_modules. You should first fix this problem by running the following:

npm install

Should i clone the repo again and run expo upgrade 39.0.0 again ?

  1. Do i run "npm install " to upgrade all other dependencies
  2. And i looked at the SDK 39 blog and didnt find any change relating to my app.

Here is the repository that i cloned:

OK, I assumed this was your own project. Not something that you had just cloned. In that case, after you clone you should run “npm install” to install all the dependencies. After that you should be able to expo upgrade 39.0.0. Then if necessary update the dependencies that expo upgrade tells you it has not updated. Then if the app still works, commit those changes before repeating the process to upgrade to SDK 40.

It is my project but i push the wrong repository to it some months back and had no choice but to clone from someone that contributed to the project some months earlier.

:rotating_light: 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:
@material-ui/core, @react-navigation/drawer, @react-navigation/material-bottom-tabs, @react-navigation/native, @react-navigation/stack, native-base, react-native-elements, react-native-paper, react-native-vector-icons, react-navigation-drawer, styled-components, styled-system, @babel/core

Please refer to the release notes for information on any further required steps to update and information about breaking changes:

I ran ;

  1. npm i react-navigation-drawer
  2. npm install @react-navigation/material-bottom-tabs react-native-paper react-native-vector-icons
  3. npm install @react-navigation/native
  4. npm install @react-navigation/stack
  5. npm install react-native-paper

Error i got:
C:\Users\hp\ecommerce delivery\Grocer-app> expo start
Starting project at C:\Users\hp\ecommerce delivery\Grocer-app
Developer tools running on http://localhost:19004
Opening developer tools in the browser…
@react-native-community/masked-view” is added as a dependency in your project’s package.json but it doesn’t seem to be installed. Please run “yarn” or “npm install” to fix this issue.

Please could you run the repository

I see.

Sorry, I should have been more clear. You should in general use expo install PACKAGE_NAME rather than npm install PACKAGE_NAME because expo knows (at least for certain dependencies like React Navigation) what versions are compatible with a given version of the Expo SDK.

This doesn’t make sense. There seems to be something weird going on with your npm or something.

If I clone your kennymanman/grocery-app repository it seems that package-lock.json is not in sync with package.json. If I run npm install, I get the following errors:

% npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-native-elements@3.4.2
npm ERR! Found: react-native-safe-area-context@3.1.4
npm ERR! node_modules/react-native-safe-area-context
npm ERR!   react-native-safe-area-context@"3.1.4" from the root project
npm ERR!   peer react-native-safe-area-context@">= 0.6.0" from @react-navigation/drawer@5.12.9
npm ERR!   node_modules/@react-navigation/drawer
npm ERR!     @react-navigation/drawer@"^5.9.0" from the root project
npm ERR!   3 more (@react-navigation/stack, native-base, expo)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-safe-area-context@"^3.1.9" from react-native-elements@3.4.2
npm ERR! node_modules/react-native-elements
npm ERR!   react-native-elements@"^3.4.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react-native-safe-area-context@3.3.2
npm ERR! node_modules/react-native-safe-area-context
npm ERR!   peer react-native-safe-area-context@"^3.1.9" from react-native-elements@3.4.2
npm ERR!   node_modules/react-native-elements
npm ERR!     react-native-elements@"^3.4.2" 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 /Users/michael/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/michael/.npm/_logs/2021-09-01T20_52_30_277Z-debug.log

If I rerun it with the --legacy-peer-deps option, it works:

% npm install --legacy-peer-deps
[...]
added 1099 packages, and audited 1100 packages in 21s
[...]

Then to make sure we have compatible package versions for the dependencies that expo-cli knows about, I ran the following (basically everything from the dependencies and devDependencies sections in package.json:

% expo install @material-ui/core
% expo install @react-native-community/masked-view
% expo install @react-navigation/drawer
% expo install @react-navigation/material-bottom-tabs
% expo install @react-navigation/native
% expo install @react-navigation/stack
% expo install expo
% expo install expo-status-bar
% expo install native-base
% expo install react
% expo install react-dom
% expo install react-native
% # expo install react-native-elements
% expo install react-native-gesture-handler
% expo install react-native-paper
% expo install react-native-reanimated
% expo install react-native-safe-area-context
% expo install react-native-screens
% expo install react-native-vector-icons
% expo install react-native-web
% expo install react-navigation-drawer
% expo install styled-components
% expo install styled-system
% expo install @babel/core
% expo install babel-preset-expo

All of those worked fine except for react-native-elements which resulted in a similar error message to the one above. Unfortunately, expo install doesn’t take a --legacy-peer-deps option. So let’s ignore that for the moment.

At this point package.json is updated as follows:

% git diff -- package.json
diff --git package.json package.json
index e7bbb96..5b8f8ab 100644
--- package.json
+++ package.json
@@ -10,15 +10,15 @@
   "dependencies": {
     "@material-ui/core": "^4.12.3",
     "@react-native-community/masked-view": "0.1.10",
-    "@react-navigation/drawer": "^5.9.0",
+    "@react-navigation/drawer": "^5.12.9",
     "@react-navigation/material-bottom-tabs": "^5.3.19",
     "@react-navigation/native": "^5.9.8",
     "@react-navigation/stack": "^5.14.9",
-    "expo": "^39.0.0",
+    "expo": "^39.0.5",
     "expo-status-bar": "~1.0.2",
     "native-base": "^3.1.0",
-    "react": "16.13.1",
-    "react-dom": "16.13.1",
+    "react": "^16.13.1",
+    "react-dom": "^16.13.1",
     "react-native": "https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz",
     "react-native-elements": "^3.4.2",
     "react-native-gesture-handler": "~1.7.0",
@@ -27,14 +27,14 @@
     "react-native-safe-area-context": "3.1.4",
     "react-native-screens": "~2.10.1",
     "react-native-vector-icons": "^8.1.0",
-    "react-native-web": "~0.13.7",
+    "react-native-web": "^0.13.18",
     "react-navigation-drawer": "^2.7.1",
     "styled-components": "^5.3.1",
     "styled-system": "^5.1.5"
   },
   "devDependencies": {
     "@babel/core": "^7.15.0",
-    "babel-preset-expo": "^8.3.0"
+    "babel-preset-expo": "^8.4.1"
   },
   "private": true
 }

Also, package-lock.json has a lot more changes. And it is now in sync with package.json. So I commit those changes with the message “Update dependencies”.

At this point I can run expo upgrade 40.0.0, tell it I don’t want to upgrade the Expo app in the iOS simulator/Android emulator and it does its thing. etc.

EDIT: expo start works fine. When loading the app in Expo Go there’s an error because you’re importing reanimated-bottom-sheet, but that’s not included in your list of dependencies in package.json, so you should expo install reanimated-bottom-sheet.

I ran the npm install --legacy-peer-deps and the expo install <package name> for all the dependencies.

When i ran expo start i got:

iOS Bundling complete 477ms
Running application on Kenny martell.

TypeError: undefined is not an object (evaluating ‘_useContext.updateCart’)

This error is located at:
in HomeScreen (at SceneView.tsx:130)
in StaticContainer
in StaticContainer (at SceneView.tsx:123)
in EnsureSingleNavigator (at SceneView.tsx:122)
in SceneView (at useDescriptors.tsx:181)
in RCTView (at View.js:34)
in View (at createAnimatedComponent.js:165)
in AnimatedComponent (at createAnimatedComponent.js:215)
in ForwardRef(AnimatedComponentWrapper) (at BottomNavigation.tsx:649)
in RCTView (at View.js:34)
in View (at createAnimatedComponent.js:165)
in AnimatedComponent (at createAnimatedComponent.js:215)
in ForwardRef(AnimatedComponentWrapper) (at BottomNavigation.tsx:634)
in RCTView (at View.js:34)
in View (at BottomNavigation.tsx:609)
in RCTView (at View.js:34)
in View (at BottomNavigation.tsx:608)
in BottomNavigation (created by Context.Consumer)
in ThemedComponent (created by withTheme(BottomNavigation))
in withTheme(BottomNavigation) (at MaterialBottomTabView.tsx:98)
in MaterialBottomTabViewInner (at MaterialBottomTabView.tsx:198)
in MaterialBottomTabView (at createMaterialBottomTabNavigator.tsx:45)
in MaterialBottomTabNavigator (at AppNavigator.js:234)
in MainTabNavigator (at SceneView.tsx:130)