首页 > 解决方案 > 需要升级现有项目的RN版本

问题描述

我正在使用 react-native 版本 0.59.5。我需要将我的 react-native 升级到最新版本 61.2。有人可以帮我弄这个吗。我必须用 podfile 进行更改吗???

React Native Environment Info:
    System:
      OS: macOS 10.14.6
      CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
      Memory: 2.56 GB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 12.4.0 - /usr/local/bin/node
      npm: 6.9.2 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
    IDEs:
      Android Studio: 3.5 AI-191.8026.42.35.5900203
      Xcode: 11.1/11A1027 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.5 => 0.59.5 
    npmGlobalPackages:
      react-native-cli: 2.0.1

我使用 react-native upgrade 我的整个 podfile 显示冲突

需要在现有项目中升级到最新版本的 react-native。我收到以下错误

info No version passed. Fetching latest...
info Fetching diff between v0.59.5 and v0.61.2...
info Applying diff...
warn Excluding files that exist in the template, but not in your project:
  - android/app/src/main/java/com/bublenet/MainActivity.java
  - android/app/src/main/java/com/bublenet/MainApplication.java
  - ios/bublenet-tvOS/Info.plist
  - ios/bublenet.xcodeproj/project.pbxproj
  - ios/bublenet/Info.plist
  - ios/bublenetTests/bublenetTests.m
error Excluding files that failed to apply the diff:
  - App.js
  - android/app/build.gradle
  - android/app/proguard-rules.pro
  - android/build.gradle
  - android/gradlew.bat
  - android/settings.gradle
  - ios/Podfile
  - ios/bublenet.xcworkspace/contents.xcworkspacedata
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.59.5&to=0.61.2
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.61.2" and its peer dependencies...
info Running "git status" to check what changed...
On branch upgrading_rn
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    new file:   .eslintrc.js
    new file:   .prettierrc.js
    new file:   android/app/debug.keystore
    modified:   android/app/src/main/res/values/styles.xml
    modified:   android/gradle/wrapper/gradle-wrapper.jar
    modified:   android/gradlew
    deleted:    android/keystores/BUCK
    deleted:    android/keystores/debug.keystore.properties
    modified:   package-lock.json
    modified:   package.json

Unmerged paths:
  (use "git reset HEAD <file>..." to unstage)
  (use "git add <file>..." to mark resolution)

    both modified:   .flowconfig
    both modified:   .gitignore
    both modified:   android/gradle.properties
    both modified:   android/gradle/wrapper/gradle-wrapper.properties

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   ios/Podfile.lock
    modified:   ios/bublenet.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings

warn Please run "git diff" to review the conflicts and resolve them
info You may find these resources helpful:
• Release notes: https://github.com/facebook/react-native/releases/tag/v0.61.2
• Manual Upgrade Helper: https://react-native-community.github.io/upgrade-helper/?from=0.59.5&to=0.61.2
• Git diff: https://raw.githubusercontent.com/react-native-community/rn-diff-purge/diffs/diffs/0.59.5..0.61.2.diff
error Upgrade failed. Please see the messages above for details. Run CLI with --verbose flag for more details.

标签: react-nativecocoapodsreact-native-androidreact-native-iospodfile

解决方案


在这种情况下,请尝试使用此站点

react-native-community.github.io/upgrade-helper 

并输入您以前和新版本以显示差异并手动更改错过的文件。


推荐阅读