ds300 / patch-package

Fix broken node modules instantly 🏃🏽‍♀️💨
MIT License
10.31k stars 288 forks source link

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

Open 5695mp opened 2 years ago

5695mp commented 2 years ago

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!

tomgiam commented 1 year ago

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!

arunkarnann commented 1 year ago

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.