**ERROR** Failed to apply patch for package @smithy/middleware-endpoint
For me the patch-package fails only on GitHub Travis CI but works locally. Using v8.0.0, yarn 1.22.22, node 22.
It would be great if there were more verbose errors including the root cause. The error report below is somewhat useless.
The question is, why cannot patch-package apply the patch? What happened?
GitHub Travis CI
yarn install v1.22.22
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
$ patch-package
patch-package 8.0.0
Applying patches...
**ERROR** Failed to apply patch for package @smithy/middleware-endpoint at path
node_modules/@smithy/middleware-endpoint
This error was caused because patch-package cannot apply the following patch file:
patches/@smithy+middleware-endpoint+4.1.11.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 @smithy/middleware-endpoint
If that doesn't work, then it's a bug in patch-package, so please submit a bug
report. Thanks!
https://github.com/ds300/patch-package/issues
---
patch-package finished with 1 error(s).
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Local
yarn install
yarn install v1.22.22
[1/5] 🔍 Validating package.json...
[2/5] 🔍 Resolving packages...
success Already up-to-date.
$ patch-package
patch-package 8.0.0
Applying patches...
@smithy/[email protected] ✔
✨ Done in 0.56s.
Well, noticed patch-package 8.1.0-canary.1
yarn install v1.22.22
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
[5/5] Building fresh packages...
$ patch-package
patch-package 8.1.0-canary.1
Applying patches...
@smithy/[email protected] ✔
Done in 31.44s.
So this seems promising but based on my logs the patch is not applied but what do I know.
All my patches stopped working when trying to upgrade RN to 0.72. I re-did them all by hand and created the patch files again, but every time I do a modification (even not related to any of the packages), I have this error for all my patched packages. I'm kinda f-ed now as a lot of libs weren't updated for the last Android requirements (having the namespace and buildConfig = true).
I had the same issue in a GitHub workflow. It worked when I deleted the actions/cache@v4 from my workflow. However, bringing that step back made it fail again.
Update: I got it to work by deleting the cache. gh cache list, copy the key, then gh cache delete <key>.