Reputation: 5674
What's the effect of "npm install" when you have a "package.json" and a "node_modules"-directory as well in your project-directory?
Does it overwrite the existing modules? Does it update them or does it nothing at all?
Upvotes: 2
Views: 944
Reputation: 7303
From the Algorithm Section in the official NPM Docs:
- load the existing node_modules tree from disk
- clone the tree
- fetch the package.json and assorted metadata and add it to the clone
- walk the clone and add any missing dependencies
- dependencies will be added as close to the top as is possible
- without breaking any other modules
- compare the original tree with the cloned tree and make a list of
- actions to take to convert one to the other
- execute all of the actions, deepest first
- kinds of actions are install, update, remove and move
So no, it does not override every existing package again.
It fetches all packages and compares the meta data between the package trees and the package file.
Upvotes: 3