npm3 - example1
Up and Running
$ npm install -g npm@3 $ npm -v # 3.5.2 $ npm install
Imagine we have a module, A. A requires B.
Now, let's create an application that requires module A.
npm install, npm v3 will install both module A and its
dependency, module B, inside the
/node_modules directory, flat.
In npm v2 this would have happened in a nested way.
Now, let's say we want to require another module, C. C requires B, but at another version than A.
However, since B v1.0 is already a top-level dep, we cannot install B v2.0 as a top level dependency. npm v3 handles this by defaulting to npm v2 behavior and nesting the new, different, module B version dependency under the module that requires it -- in this case, module C.
In the terminal, this looks like this:
You can list the dependencies and still see their relationships using
If you want to just see your primary dependencies, you can use:
npm ls --depth=0