
To remove a patch that you previously applied using patch-package, follow these steps:
- Open a terminal in the root of your project where the
package.jsonfile is located. - Execute the following command to undo the patch:
npx patch-package --reverse [package-name]
Replace [package-name] with the name of the package for which you want to undo the patch. For example, if the patch was applied to react-native, you would run:
npx patch-package --reverse react-native
This command will revert the changes made by the patch in the node_modules/[package-name] directory and remove the related .patch file in the patches folder within your project.
- After running the command, verify that the changes have been successfully reverted. You can inspect the
node_modules/[package-name]directory to ensure that the files have returned to their original state. - Additionally, check the
patchesfolder in your project to ensure that the.patchfile related to the package and version you reverted has been deleted.
Furthermore, you need to remove the postinstall: patch-package from packcage.json:

- Once you’ve confirmed that the patch has been removed, you can run
yarn installornpm installagain to ensure that all dependencies are in their correct state.
It’s important to be cautious when making changes to dependencies and patches, as they can impact the stability of your project. It’s always recommended to thoroughly test in a development environment before applying significant changes in production.
