React Native – How to fix node_modules?

Use patch-package
easier-react-native-upgrade-with-patch-package
say-goodbye-to-old-fashioned-forks-thanks-to-the-patch-package

Setup

  • Install package
yarn add patch-package postinstall-postinstall
  • Edit package.json > scripts
 "scripts": {
   "postinstall": "patch-package"
 }

Create patch

  • Fix & save file in node_modules
  • Create patch, a patches directory will be created
yarn run patch-package react-native-material-menu
  • From now on it will automatically patch the module when you install dependencies
> yarn
yarn install v0.27.5
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
$ patch-package
patch-package: Applying patches...
react-native-material-menu ✔

Be the first to comment

Leave a Reply

Your email address will not be published.


*