react-native-community / upgrade-support

A central community-backed place to request and give help when upgrading your app.
MIT License
261 stars 2 forks source link

Cannot upgrade from 0.63.4 to 0.64, 0.65 or 0.66 #178

Closed tijs closed 3 years ago

tijs commented 3 years ago

Environment

System: OS: macOS 11.6 CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 3.11 GB / 32.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.4.0 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.21.1 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.2 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0 Android SDK: Not Found IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7678000 Xcode: 13.0/13A233 - /usr/bin/xcodebuild Languages: Java: 11.0.12 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.65.1 => 0.65.1 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Things I’ve done to figure out my issue

Upgrading version

I would like to upgrade to the latest stable from 0.63.4, tried 0.64, 0.65 and the 0.66 rc versions

Description

As soon as I bump the react-native version beyond 0.63.4, even if I keep my babel versions the same, metro stops being able to create a valid bundle.

If I run:

npx react-native bundle --platform ios --entry-file index.js --bundle-output ./bundles/index.ios.bundle --assets-dest ./bundles/ --dev true

I will get the following error:

error lib/src/service/LocationService.ts: function (path) {
          return fn.call(state, path, state);
        } could not be cloned.
Error: function (path) {
          return fn.call(state, path, state);
        } could not be cloned.
    at Object.serialize (node:v8:260:7)
    at _default (/Users/tijs/projects/persgroep/popular-platform-app/node_modules/@babel/core/lib/transformation/util/clone-deep.js:22:34)
    at normalizeFile (/Users/tijs/projects/persgroep/popular-platform-app/node_modules/@babel/core/lib/transformation/normalize-file.js:84:36)
    at normalizeFile.next (<anonymous>)
    at run (/Users/tijs/projects/persgroep/popular-platform-app/node_modules/@babel/core/lib/transformation/index.js:29:50)
    at run.next (<anonymous>)
    at /Users/tijs/projects/persgroep/popular-platform-app/node_modules/@babel/core/lib/transform-ast.js:26:41
    at Generator.next (<anonymous>)
    at evaluateSync (/Users/tijs/projects/persgroep/popular-platform-app/node_modules/gensync/index.js:251:28)

If I remove the import of that file it just fails on something else:

error src/nieuws-wereld/src/common/linking/Navigations.ts: #<WeakSet> could not be cloned.
Error: #<WeakSet> could not be cloned.
    at Object.serialize (node:v8:260:7)
    at _default (/Users/tijs/projects/persgroep/popular-platform-app/node_modules/@babel/core/lib/transformation/util/clone-deep.js:22:34)
    at normalizeFile (/Users/tijs/projects/persgroep/popular-platform-app/node_modules/@babel/core/lib/transformation/normalize-file.js:84:36)
    at normalizeFile.next (<anonymous>)
    at run (/Users/tijs/projects/persgroep/popular-platform-app/node_modules/@babel/core/lib/transformation/index.js:29:50)
    at run.next (<anonymous>)
    at /Users/tijs/projects/persgroep/popular-platform-app/node_modules/@babel/core/lib/transform-ast.js:26:41
    at Generator.next (<anonymous>)
    at evaluateSync (/Users/tijs/projects/persgroep/popular-platform-app/node_modules/gensync/index.js:251:28)

So while I cannot find anything on the particular babel error it seems clear it cannot transform any (or most) files in my project.

I have fixed a lot of other upgrade issues by now (see my other issues on here) but I have not found any solutions (or similar issues on GitHub) for this one... any pointers on where I should be poking are very welcome!

tijs commented 3 years ago

Ok so it turns out that simply throwing away the yarn.lock and running yarn again somehow fixed all the babel issues. Apparently your yarn.lock can become such a mess nothing works anymore.

Hat tip to the comment here https://github.com/facebook/react-native/issues/31413#issuecomment-921267102