Best way to prevent a node_modules package from updating

Viewed 1282

I have downloaded/installed a node_module (npm package)... I have played around with the internal files to suit my needs inside the node_modules folder. It is the most convenient for me to just use it as a node_module, but I'm worried that the next time I update npm packages it might update and erase all of the changes I have made. What is the best way to make sure only that particular package should not be updated?

Thank you very much

2 Answers

Make the version of that package specific in package.json file. For example you manually added 3.0.0 version of express in dependencies or devDependencies, change the entry of express as:

"express":"3.0.0"

You can store your own/modified packages either locally (e.g. in a common place outside of the project) or in the cloud (e.g. GitHub) and then reference the package via the file path or repository URL respectively.

Check here:

Related