Cli: [0.62.2 -> 0.63.0] react-native upgrade fails

Created on 9 Jul 2020  路  4Comments  路  Source: react-native-community/cli

Environment

System:
    OS: Linux 4.15 Ubuntu 18.04.4 LTS (Bionic Beaver)
    CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
    Memory: 10.72 GB / 31.37 GB
    Shell: 5.4.2 - /usr/bin/zsh
  Binaries:
    Node: 12.18.1 - ~/.local/opt/n/bin/node
    Yarn: 1.22.4 - ~/.local/opt/n/bin/yarn
    npm: 6.14.5 - ~/.local/opt/n/bin/npm
    Watchman: Not Found
  SDKs:
    Android SDK:
      API Levels: 27, 28
      Build Tools: 27.0.3, 28.0.3
      System Images: android-22 | Google APIs Intel x86 Atom, android-23 | Google APIs ARM EABI v7a, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: Not Found
  Languages:
    Java: 1.8.0_252 - /usr/bin/javac
    Python: 2.7.17 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1
    react-native: 0.63.0 => 0.63.0
  npmGlobalPackages:
    *react-native*: Not Found

Description

npx react-native upgrade failed to upgrade my react-native app from 0.62.2 to 0.63.0.

info No version passed. Fetching latest...
info Fetching diff between v0.62.2 and v0.63.0...
info Applying diff...
warn Excluding files that exist in the template, but not in your project:

error Excluding files that failed to apply the diff:
  - MyProject/android/gradlew.bat
  - MyProject/ios/Podfile
  - MyProject/ios/MyProject.xcodeproj/project.pbxproj
  1. Zero files changed by the upgrade command
  2. Not all the files listed on the upgrade-helper diff appear in the "failed to apply the diff" list
  3. 2/3 of the problematic files also appeared to cause problems on a brand new react-native app

Reproducible Demo

To sanity-check, I did the following:

react-native init --version="[email protected]" ReactNativeUpgradeTest
cd ReactNativeUpgradeTest
react-native upgrade

And I got this output:

info No version passed. Fetching latest...
info Fetching diff between v0.62.2 and v0.63.0...
info Applying diff...
warn Excluding files that exist in the template, but not in your project:

error Excluding files that failed to apply the diff:
  - android/gradlew.bat
  - ios/ReactNativeUpgradeTest.xcodeproj/project.pbxproj
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.62.2&to=0.63.0
info Installing "[email protected]" and its peer dependencies...
info Running "git status" to check what changed...
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   .flowconfig
        modified:   android/app/build.gradle
        modified:   android/build.gradle
        modified:   android/gradle.properties
        modified:   android/gradle/wrapper/gradle-wrapper.jar
        modified:   android/gradle/wrapper/gradle-wrapper.properties
        modified:   android/gradlew
        modified:   ios/Podfile
        modified:   ios/ReactNativeUpgradeTest-tvOSTests/Info.plist
        modified:   ios/ReactNativeUpgradeTest/AppDelegate.m
        deleted:    ios/ReactNativeUpgradeTest/Base.lproj/LaunchScreen.xib
        new file:   ios/ReactNativeUpgradeTest/LaunchScreen.storyboard
        modified:   package.json
        modified:   yarn.lock

success Upgraded React Native to v0.63.0 馃帀. Now you can review and commit the changes

I do see changes in this case, but it still has errors applying the diff to:

  • android/gradlew.bat
  • ios/ReactNativeUpgradeTest.xcodeproj/project.pbxproj
bug report

Most helpful comment

I got the same error after executing npx react-native upgrade:

info No version passed. Fetching latest...
info Fetching diff between v0.62.2 and v0.63.2...
info Applying diff...
warn Excluding files that exist in the template, but not in your project:
  - .flowconfig
  - ios/RNApp-tvOSTests/Info.plist
error Excluding files that failed to apply the diff:
  - android/app/build.gradle
  - android/build.gradle
  - android/gradle.properties
  - android/gradle/wrapper/gradle-wrapper.jar
  - android/gradle/wrapper/gradle-wrapper.properties
  - android/gradlew.bat
  - ios/Podfile
  - ios/RNApp.xcodeproj/project.pbxproj
  - ios/RNApp/AppDelegate.m
  - ios/RNApp/Base.lproj/LaunchScreen.xib
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.62.2&to=0.63.2

I wanted to upgrade from 0.62.2 to 0.63.2

All 4 comments

I got the same error after executing npx react-native upgrade:

info No version passed. Fetching latest...
info Fetching diff between v0.62.2 and v0.63.2...
info Applying diff...
warn Excluding files that exist in the template, but not in your project:
  - .flowconfig
  - ios/RNApp-tvOSTests/Info.plist
error Excluding files that failed to apply the diff:
  - android/app/build.gradle
  - android/build.gradle
  - android/gradle.properties
  - android/gradle/wrapper/gradle-wrapper.jar
  - android/gradle/wrapper/gradle-wrapper.properties
  - android/gradlew.bat
  - ios/Podfile
  - ios/RNApp.xcodeproj/project.pbxproj
  - ios/RNApp/AppDelegate.m
  - ios/RNApp/Base.lproj/LaunchScreen.xib
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.62.2&to=0.63.2

I wanted to upgrade from 0.62.2 to 0.63.2

Same issue

Similar error but from 0.63.3 to 0.63.4

error Excluding files that failed to apply the diff:
  - ios/MuralFestival.xcodeproj/project.pbxproj
Please make sure to check the actual changes after the upgrade command is finished.

If you want to upgrade with React Native CLI but you don't use Git#
While your project does not have to be handled by the Git versioning system -- you can use Mercurial, SVN, or nothing -- you will still need to install Git on your system in order to use npx react-native upgrade. Git will also need to be available in the PATH. If your project doesn't use Git, initialize it and commit:

git init # Initialize a Git repository
git add . # Stage all the current files
git commit -m "Upgrade react-native" # Save the current files in a commit

After you finish upgrading you may remove the .git directory.

https://reactnative.dev/docs/upgrading#i-want-to-upgrade-with-react-native-cli-but-i-don-t-use-git

Was this page helpful?
0 / 5 - 0 ratings