需要升级现有项目的RN版本

时间:2019-10-15 11:13:37

标签: react-native cocoapods react-native-android react-native-ios podfile

我正在使用本机版本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升级,我的整个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.

1 个答案:

答案 0 :(得分:0)

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

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

,然后输入您的先前版本和新版本以显示差异并手动更改丢失的文件。