**ERROR** Failed to apply patch for package react-native at path
I have add one patch file in my project which remove the duplicate resorese in android
but when I ran the yarn install its give me this error.
Applying patches...
ERROR Failed to apply patch for package react-native at path
node_modules/react-native
This error was caused because patch-package cannot apply the following patch file:
patches/react-native+0.63.4.patch
Try removing node_modules and trying again. If that doesn't work, maybe there was an accidental change made to the patch file? Try recreating it by manually editing the appropriate files and running:
patch-package react-native
If that doesn't work, then it's a bug in patch-package, so please submit a bug report. Thanks!ERROR Failed to apply patch for package react-native at path
i alsoo
Has anyone figured out a way to fix this? I'm having this issue with the next package
Edit: Figured it out. This was happening for me because the diff had for some reason included some auto generated licensing information. Once I delete that from the diff (leaving only the changes I had made myself behind) it worked
I made it work by deleting the code above the modified section , like this:
# diff --git a/node_modules/react-native/Libraries/Animated/release/.npmignore b/node_modules/react-native/Libraries/Animated/release/.gitignore
# similarity index 100%
# rename from node_modules/react-native/Libraries/Animated/release/.npmignore
# rename to node_modules/react-native/Libraries/Animated/release/.gitignore
# diff --git a/node_modules/react-native/ReactAndroid/src/main/jni/first-party/fbjni/.npmignore b/node_modules/react-native/ReactAndroid/src/main/jni/first-party/fbjni/.gitignore
# similarity index 100%
# rename from node_modules/react-native/ReactAndroid/src/main/jni/first-party/fbjni/.npmignore
# rename to node_modules/react-native/ReactAndroid/src/main/jni/first-party/fbjni/.gitignore
# diff --git a/node_modules/react-native/ReactCommon/hermes/inspector/tools/msggen/.npmignore b/node_modules/react-native/ReactCommon/hermes/inspector/tools/msggen/.gitignore
# similarity index 100%
# rename from node_modules/react-native/ReactCommon/hermes/inspector/tools/msggen/.npmignore
# rename to node_modules/react-native/ReactCommon/hermes/inspector/tools/msggen/.gitignore
# diff --git a/node_modules/react-native/react.gradle b/node_modules/react-native/react.gradle
index c28cbd4..6fab829 100644
--- a/node_modules/react-native/react.gradle
+++ b/node_modules/react-native/react.gradle
@@ -307,6 +307,11 @@ afterEvaluate {
def mergeResourcesTask = tasks.findByName("merge${targetName}Resources")
mergeResourcesTask.dependsOn(currentAssetsCopyTask)
+ //add by xc.
+ def compressAssetsTask = tasks.findByName("compress${targetName}Assets")
+ compressAssetsTask.dependsOn(currentAssetsCopyTask)
+
+
packageTask.dependsOn(currentAssetsCopyTask)
if (buildPreBundleTask != null) {
buildPreBundleTask.dependsOn(currentAssetsCopyTask)
I did remove node_modules and run "patch-package react-native" but all of them not working
I don't know if anyone still looks up for this issue. My issue was the difference of resolved version in yarn.lock. I had a different package.json versions in my case, and i copied the code and it didn't work because the yarn.lock was already generated. I just copied over the old yarn file and it worked perfectly.