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

8.0.0 seems to fail when modifying the folder structure of a library on `postinstall`

Open AlbertoMeQ opened this issue 1 year ago • 1 comments

As in the title, it seems that the latest version (8.0.0) fails on a package during postinstall but not when re-running patch-package.

I did some investigations and it seems that it's only caused when renaming the folder of a library. Here are the steps to reproduce it:

  1. Rename a sub-folder of a library
  2. Modify content of a file inside that newly renamed folder
  3. Create patch file
  4. Remove node_modules
  5. npm i with patch-package in postinstall
  6. Notice error

For now, I will be reverting to 7.0.0 as the issue doesn't seem to occur there.

AlbertoMeQ avatar Aug 17 '23 12:08 AlbertoMeQ

Same, but mine was failing every time. I was trying to apply this patch for rn-secure-storage and with 8.0.0 I'm getting an error:

patch-package 8.0.0
Applying patches...

**ERROR** Failed to apply patch for package rn-secure-storage at path
    node_modules/rn-secure-storage
This error was caused because patch-package cannot apply the following patch file:
    patches/rn-secure-storage+2.0.8.patch
[...]

The patch basically removes the file rn-secure-storage/iOS/RNSecureStorage.podspec and then "re-create" the file inside the root folder rn-secure-storage/RNSecureStorage.podspec, with some internal changes.

With version 7.0.2 of patch-package this is not happening. I'm on Mac M2, Node 16, using yarn.

Martinocom avatar Sep 07 '23 13:09 Martinocom