patch-package icon indicating copy to clipboard operation
patch-package copied to clipboard

**ERROR** Failed to apply patch for package react-native at path (node_modules/react-native)

Open 5695mp opened this issue 3 years ago • 2 comments

This error was caused because patch-package cannot apply the following patch file:

patches/react-native+0.69.5.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!

5695mp avatar Sep 03 '22 10:09 5695mp

I have the same issue, but with react native 0.69.6.

The odd thing is that even though I only changed 6 lines in one file (index.js), the patch file was indicating lots of changes in lots of files and contained 180,000 lines. My other patch file was only 22 lines and looked correct.

I used the command npx patch-package react-native and the version of patch-package is 6.4.7.

UPDATE: I fixed the patch file size by: yarn global add react-native npx patch-package react-native --use-yarn

It was probably diffing different versions. Now I will see if eas works correctly.

UPDATE2: The eas build worked!

This also fixed my original problem of eas builds crashing on device. The crash was probably due to the package patches that I was doing manually, which work while debugging and even work with the expo build process, but not with eas build because that probably uses the packages without the changes.

Thanks!

tomgiam avatar Oct 13 '22 13:10 tomgiam

I have the same issue, but with react native 0.69.6.

The odd thing is that even though I only changed 6 lines in one file (index.js), the patch file was indicating lots of changes in lots of files and contained 180,000 lines. My other patch file was only 22 lines and looked correct.

I used the command npx patch-package react-native and the version of patch-package is 6.4.7.

UPDATE: I fixed the patch file size by: yarn global add react-native npx patch-package react-native --use-yarn

It was probably diffing different versions. Now I will see if eas works correctly.

UPDATE2: The eas build worked!

This also fixed my original problem of eas builds crashing on device. The crash was probably due to the package patches that I was doing manually, which work while debugging and even work with the expo build process, but not with eas build because that probably uses the packages without the changes.

Thanks!

This worked for me especially yarn patch-package react-native --use-yarn

worked.

arunkarnann avatar Jul 11 '23 13:07 arunkarnann