If I have node modules installed locally (in the same folder as my node app) will they override global installations of the same modules?
Usually you install NPM modules globally if you want them included in your path to be ran from the command line. Since it is installed locally you will have to run it from the node_modules folder.
When npm install is run, it will examine the package. json file and attempt to install any dependencies listed that are not already installed to the node_modules directory. If there are no dependencies listed, it replaces the entire node_modules directory.
Yes. See the documentation here on module resolution. And, just to be clear, "override" here simply means that the local module is the one that will be resolved to. The global module will be left untouched, and node.js apps in other directories will still be able to use the global module.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With