Upgrading ReactNative from 0.69.4 -> 0.71.4 (failed)
• Mark Eschbach
Time to update my personal app to the latest React Native version. For those who are seriously using React Native have already upgraded but for those who have not here are my notes. App main usage is on Android as I have not published an iOS version yet.
Major changes in 0.69
…0.72
- Gradle changes in nearly every version.
- A lot of CLI + Code Gen changes.
Overall it does not look like too many user level changes. Should be fairly straight forward. Based on the React Native documentation this should be a fairly straight forward process:
npx react-native upgrade
Well…I received a ton of errors along the lines of the following:
warn Package @sentry/react-native contains invalid configuration: "dependency.platforms.ios.sharedLibraries" is not allowed,"dependency.hooks" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.
warn Package react-native-sqlite-storage contains invalid configuration: "dependency.platforms.ios.project" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.
info No version passed. Fetching latest...
info Fetching diff between v0.69.4 and v0.71.4...
info Applying diff...
warn Excluding files that exist in the template, but not in your project:
- .flowconfig
- App.js
- __tests__/App-test.js
- ios/mee.xcworkspace/contents.xcworkspacedata
error Excluding files that failed to apply the diff:
- android/app/build.gradle
- android/app/src/main/AndroidManifest.xml
- android/app/src/main/java/com/eschbachgroup/thebachs/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java
- android/app/src/main/jni/Android.mk
- android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h
- android/app/src/main/jni/MainComponentsRegistry.h
Please make sure to check the actual changes after the upgrade command is finished.
You can find them in our Upgrade Helper web app: https://react-native-community.github.io/upgrade-helper/?from=0.69.4&to=0.71.4
error Automatically applying diff failed. We did our best to automatically upgrade as many files as possible
warn Continuing after failure. Some of the files are upgraded but you will need to deal with conflicts manually
info Installing "react-native@0.71.4" and its peer dependencies...
info Running "git status" to check what changed...
On branch main
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: package.json
modified: yarn.lock
warn Please run "git diff" to review the conflicts and resolve them
warn After resolving conflicts don't forget to run "pod install" inside "ios" directory
info You may find these resources helpful:
• Release notes: https://github.com/facebook/react-native/releases/tag/v0.71.4
• Manual Upgrade Helper: https://react-native-community.github.io/upgrade-helper/?from=0.69.4&to=0.71.4
• Git diff: https://raw.githubusercontent.com/react-native-community/rn-diff-purge/diffs/diffs/0.69.4..0.71.4.diff
error Upgrade failed. Please see the messages above for details.
info Run CLI with --verbose flag for more details.
So running yarn android dev --variant=Debug --appIdSuffix=debug
resulted in a the following error:
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
e: /Users/gremlin/wc/mee/apps/mobile/mee/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleHermesCTask.kt: (138, 11): This declaration is experimental and its usage must be marked with '@kotlin.ExperimentalStdlibApi' or '@OptIn(kotlin.ExperimentalStdlibApi::class)'
Seems to indicate something went wrong with react-native-gradle-plugin
. Looking through the updated diff in the log
message none
if it seems to have been applied. At this point I’ll revisit another time.