I have made changes to my node modules library, Is there a way where I can freez those changes and they are not lost when I run npm install. I have made changes to react native firebase library, but sometimes when i do npm install they are lost.
Asked
Active
Viewed 607 times
0
-
3You mean you've changed your dependencies' code inside `node_modules/`? That's not a very good idea. You could maintain your own fork, or use e.g. `npm link` to connect to a local directory while you're working on it. – jonrsharpe Mar 05 '19 at 11:44
-
I did npm link, but still getting build issues. My last option was to update my react native ffirebase library and it worked after that – Anjali Rughani Mar 05 '19 at 12:18
-
by default `npm install` get the libraries from packages.json so if the lib you modified is in the list try removing it and then try `npm install` and check whether the library replaces or not. – Amol Gangadhare Mar 05 '19 at 12:21
-
Possible duplicate of [How to edit a node module installed via npm?](https://stackoverflow.com/questions/13300137/how-to-edit-a-node-module-installed-via-npm) – Andrew Mar 05 '19 at 13:00
1 Answers
1
You can use the patch-package module for this. It will create a diff file that you can commit to version control. After npm install is run, it will apply the diff file to node_modules. This way you can make fixes to node_modules without having to fork or send a PR and hope it will someday be accepted.

basbase
- 1,225
- 7
- 19