Read more about node_modules
and how you can use them in official node/iojs docs:
If the module identifier passed to require() is not a native module, and does not begin with '/', '../', or './', then io.js starts at the parent directory of the current module, and adds /node_modules, and attempts to load the module from that location.
If it is not found there, then it moves to the parent directory, and so on, until the root of the file system is reached.
Here I show you how you can easily build a hierarchy of modules inside your project and use nested node_modules
directories to manage dependencies within your application. This is a pretty good solution that doesn't require you to change NODE_PATH
, use many git repositories or setting up a private registry.