Reputation: 2107
I wonder if there is an explanation somewhere (maybe on node js website) about the next situation related to packages:
I installed a sample application, let's say in d:\samples\backbone directory, meaning that also the node packages were created there.
Listing the installed packages with npm list from command line in d:\samples\backbone\option2 directory will show me the installed packages, the same if I run in d:\samples\backbone. If running in d:\samples directory, the packages are not shown anymore.
I guess that node searches for installed packages in all directories up to the root, but is somewhere in docs mentioned about it?
Upvotes: 0
Views: 253
Reputation: 6822
If you look at Node.js' documentation, on the modules page - http://nodejs.org/api/modules.html - take a look at the sections:
You'll find how require()
is resolved.
Upvotes: 1
Reputation: 41597
Any globally installed modules (for exmaple: npm install -g express) are installed in C:\Program Files (x86)\nodejs\node_modules
Anything that has been locally installed (such as async, mysql), is placed in your directory inside a ./node_modules/
folder.
In this case, your backbone app has local dependancies, so its packages are installed locally inside d:\samples\backbone\node_modules
Upvotes: 2