Good day React Native team, keep up the amazing work!
I'm attempting to upgrade from RN v0.35 to v0.39.1. I first tried upgrading with the traditional react-native upgrade but that method no longer gives you the ability to see a diff for the changed files (which was a really useful feature IMO).
So I opted for the new react-native-git-upgrade, which _seems_ to work. However, after the upgrade is done, there are no physical changes to any of the files in my project.
I keep seeing these errors in the output, which seem awfully different from the rest of the errors:
error: cannot apply binary patch to 'android/app/src/main/res/mipmap-hdpi/ic_launcher.png' without full index line
Falling back to three-way merge...
Here's the full output of the upgrade, followed by a git status showing no changes made to the project.
$ react-native-git-upgrade
git-upgrade info Check for updates
git-upgrade info Read package.json files
git-upgrade info Check declared version
git-upgrade info Check matching versions
git-upgrade info Check React peer dependency
git-upgrade info Check that Git is installed
git-upgrade info Get information from NPM registry
git-upgrade info Upgrading to React Native 0.39.1, React ~15.4.0-rc.4
git-upgrade info Setup temporary working directory
git-upgrade info Configure Git environment
git-upgrade info Init Git repository
git-upgrade info Add all files to commit
git-upgrade info Commit current project sources
git-upgrade info Create a tag before updating sources
git-upgrade info Generate old version template
git-upgrade info Add updated files to commit
git-upgrade info Commit old version template
git-upgrade info Install the new version
npm WARN deprecated [email protected]: use uuid module instead
git-upgrade info Generate new version template
git-upgrade info Add updated files to commit
git-upgrade info Commit new version template
git-upgrade info Generate the patch between the 2 versions
git-upgrade info Save the patch in temp directory
git-upgrade info Reset the 2 temporary commits
git-upgrade info Apply the patch
error: patch failed: .gitignore:22
Falling back to three-way merge...
Applied patch to '.gitignore' with conflicts.
error: patch failed: android/app/src/main/java/com/beepyonative/MainApplication.java:8
Falling back to three-way merge...
Applied patch to 'android/app/src/main/java/com/beepyonative/MainApplication.java' with conflicts.
error: cannot apply binary patch to 'android/app/src/main/res/mipmap-hdpi/ic_launcher.png' without full index line
Falling back to three-way merge...
error: cannot apply binary patch to 'android/app/src/main/res/mipmap-hdpi/ic_launcher.png' without full index line
error: android/app/src/main/res/mipmap-hdpi/ic_launcher.png: patch does not apply
error: cannot apply binary patch to 'android/app/src/main/res/mipmap-mdpi/ic_launcher.png' without full index line
Falling back to three-way merge...
error: cannot apply binary patch to 'android/app/src/main/res/mipmap-mdpi/ic_launcher.png' without full index line
error: android/app/src/main/res/mipmap-mdpi/ic_launcher.png: patch does not apply
error: cannot apply binary patch to 'android/app/src/main/res/mipmap-xhdpi/ic_launcher.png' without full index line
Falling back to three-way merge...
error: cannot apply binary patch to 'android/app/src/main/res/mipmap-xhdpi/ic_launcher.png' without full index line
error: android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: patch does not apply
error: cannot apply binary patch to 'android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png' without full index line
Falling back to three-way merge...
error: cannot apply binary patch to 'android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png' without full index line
error: android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: patch does not apply
error: patch failed: ios/BeepyoNative.xcodeproj/project.pbxproj:22
Falling back to three-way merge...
Applied patch to 'ios/BeepyoNative.xcodeproj/project.pbxproj' with conflicts.
error: patch failed: ios/BeepyoNative/Info.plist:45
Falling back to three-way merge...
Applied patch to 'ios/BeepyoNative/Info.plist' cleanly.
git-upgrade WARN The upgrade process succeeded but there might be conflicts to be resolved. See above for the list of files that have merge conflicts.
git-upgrade info Upgrade done
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
Assuming my hunch about the android icons is correct...
cd path/to/projectreact-native-git-upgradeThanks for the detailed report 馃
We want the git apply command run by react-native-git-upgrade under the hood to ignore these files. I think the exclude option of the apply should do the trick.
In the meantime, here is a dirty workaround:
Git provides 3 different "ignore" files:
.gitignore.git/info/exclude$HOME/.gitignoreWe can't rely on the first one because it is overrided by the upgrading process. We can't rely on the second as well because we create a temporary repository on-the-fly. Let's use the third:
$ echo "*.png" > ~/.gitignore # Tell ALL your repos to ignore PNG files
$ react-native-git-upgrade # It should be working now
$ rm ~/.gitignore # IMPORTANT don't forget to delete this file otherwise, ALL your repos would ignore the PNG files
I needed to run git config --global core.excludesfile '~/.gitignore
in order to use the workaround
@ncuillery brilliant! Dirty workaround worked. Thanks! :D
Adding the exclude option fixes the issue related to custom icons but in my case I still see an error related to project.pbxproj.
$ git apply --exclude=*.png /var/folders/lz/d392c5b17p1dcyhzbn2yrpsh0000gn/T/react-native-git-upgrade/upgrade_0.38.1_0.39.2.patch
error: patch failed: ios/MyProject.xcodeproj/project.pbxproj:22
error: ios/MyProject.xcodeproj/project.pbxproj: patch does not apply
Do you guys have any idea on how to fix this ? Thanks.
Hello!
After I run the command, my dependencies are upgraded inside node_modules but my package.json is not updated, is that normal?
Also the build doesn't work anymore, after running the upgrade command my project.pbxproj from xcode project gets deleted. Reverting it with git brings back the file, but the build is still not working.
This is the log after the react-native-git-upgrade:
$ react-native-git-upgrade
git-upgrade info Check for updates
git-upgrade info Read package.json files
git-upgrade info Check declared version
git-upgrade info Check matching versions
git-upgrade info Check React peer dependency
git-upgrade info Check that Git is installed
git-upgrade info Get information from NPM registry
git-upgrade info Upgrading to React Native 0.40.0, React ~15.4.0-rc.4
git-upgrade info Setup temporary working directory
git-upgrade info Configure Git environment
git-upgrade info Init Git repository
git-upgrade info Add all files to commit
git-upgrade info Commit current project sources
git-upgrade info Create a tag before updating sources
git-upgrade info Generate old version template
git-upgrade info Add updated files to commit
git-upgrade info Commit old version template
git-upgrade info Install the new version
npm WARN [email protected] requires a peer of whatwg-fetch@^1.0.0 but none was installed.
git-upgrade info Generate new version template
git-upgrade info Add updated files to commit
git-upgrade info Commit new version template
git-upgrade info Generate the patch between the 2 versions
git-upgrade info Save the patch in temp directory
git-upgrade info Reset the 2 temporary commits
git-upgrade info Apply the patch
error: patch failed: .gitignore:22
Falling back to three-way merge...
Applied patch to '.gitignore' with conflicts.
error: patch failed: android/app/src/main/java/com/sealjobs/MainApplication.java:8
Falling back to three-way merge...
Applied patch to 'android/app/src/main/java/com/sealjobs/MainApplication.java' with conflicts.
error: ios/sealJobs.xcodeproj/project.pbxproj: does not exist in index
error: patch failed: ios/sealJobs.xcodeproj/xcshareddata/xcschemes/sealJobs.xcscheme:37
Falling back to three-way merge...
Applied patch to 'ios/sealJobs.xcodeproj/xcshareddata/xcschemes/sealJobs.xcscheme' cleanly.
error: patch failed: ios/sealJobs/AppDelegate.m:9
Falling back to three-way merge...
Applied patch to 'ios/sealJobs/AppDelegate.m' with conflicts.
git-upgrade WARN The upgrade process succeeded but there might be conflicts to be resolved. See above for the list of files that have merge conflicts.
git-upgrade info Upgrade done
$ git status
On branch improvements/bug-fixes-and-tweaks
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: android/app/src/main/res/mipmap-hdpi/ic_launcher.png
modified: android/app/src/main/res/mipmap-mdpi/ic_launcher.png
modified: android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
modified: android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
deleted: ios/sealJobs.xcodeproj/project.pbxproj
no changes added to commit (use "git add" and/or "git commit -a")
The build error that I get:
** BUILD FAILED **
The following build commands failed:
CompileC /Users/razvan/Projects/sealJobs/ios/build/Build/Intermediates/RCTText.build/Debug-iphonesimulator/RCTText.build/Objects-normal/x86_64/RCTTextManager.o RCTTextManager.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/razvan/Projects/sealJobs/ios/build/Build/Intermediates/RCTNetwork.build/Debug-iphonesimulator/RCTNetwork.build/Objects-normal/x86_64/RCTNetworkTask.o RCTNetworkTask.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/razvan/Projects/sealJobs/ios/build/Build/Intermediates/RCTNetwork.build/Debug-iphonesimulator/RCTNetwork.build/Objects-normal/x86_64/RCTDataRequestHandler.o RCTDataRequestHandler.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/razvan/Projects/sealJobs/ios/build/Build/Intermediates/RCTFBSDK.build/Debug-iphonesimulator/RCTFBSDK.build/Objects-normal/x86_64/RCTFBSDKAppEvents.o RCTFBSDK/core/RCTFBSDKAppEvents.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(4 failures)
Anybody has a clue of what's going on?
I am trying to upgrade from [email protected] to latest on a MacOS machine.
@razvan-tudosa it seems strange to me. My guess is that your workspace is corrupted after several attempts to make that work.
I'd recommend:
npm install the old version of RN (0.36.1), checking that your application is working,react-native-git-upgrade --verbose (the verbose option will show the output of each git command, which is useful to debug).If you have changed the default app icons (ic_launcher.png files). Try my workaround here
After I realized that 0.40.0 has a lot of breaking changes that need all of my project's dependencies to be upgraded (and I wasn't sure that everybody updated their packages) I gave up and tried to upgrade to 0.39.0 by hand and somehow I got it to work without using the upgrade tool.
Besides that I'm still curios what could cause the project.pbxproj file to get deleted since I tried to run the command on a colleagues machine and got the same result.
Other than that I'm hoping my next experience with the tool will be better because I think that the idea behind it is a very nice one.
I had to ignore svg files too. Also I had to change my AppDelegate and main files to *.m.
*.mm caused it to fail.
I lost my files under the project folder
I upgrade my project from RN0.32.1 to RN 0.44.0, I can't open my project, and I lost some files.
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!
If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.
Still get this error while upgrading 0.44.0 to 0.46, anyone know how to solve the conflict?
Still get this error.
@hramos, this issue should absolutely stay open. There are a lot of people reporting this issue, and no one to pick up the problem. This is a really pressing problem as it removes a lot of the kind of code that takes a while to figure out, so we are all stuck rebuilding our projects from square one. react-native-git-upgrade should absolutely not be used until this can be fixed.
@mienaikoe "no one to pick up the problem" is one reason the issue was closed.
@ncuillery thoughts on leaving this open?
@ncuillery
after that:
$ echo "*.png" > ~/.gitignore # Tell ALL your repos to ignore PNG files
$ react-native-git-upgrade # It should be working now
$ rm ~/.gitignore # IMPORTANT don't forget to delete this file otherwise, ALL your repos would ignore the PNG files
I keep seeing these errors in the output:
error: patch failed: android/app/src/main/AndroidManifest.xml:1
Falling back to three-way merge...
Applied patch to 'android/app/src/main/AndroidManifest.xml' with conflicts.
error: android/app/src/main/java/com/programgirl/MainApplication.java: does not exist in index
error: patch failed: ios/ProgramGirl.xcodeproj/project.pbxproj:25
Falling back to three-way merge...
Applied patch to 'ios/ProgramGirl.xcodeproj/project.pbxproj' with conflicts.
error: patch failed: ios/ProgramGirl/AppDelegate.m:18
Falling back to three-way merge...
Applied patch to 'ios/ProgramGirl/AppDelegate.m' cleanly.
how to solve it?
Most helpful comment
Adding the
excludeoption fixes the issue related to custom icons but in my case I still see an error related toproject.pbxproj.Do you guys have any idea on how to fix this ? Thanks.