Does NPM load certain modules after it is installed (for its own use)?

Problem

I had some issues with NPM so I decided to simply uninstall Node, NPM & NVM and then reinstall everything on Mac OS X 10.8. After following various guides and Stackoverflow questions I was pretty sure I had gotten rid of everything. But to my surprise after I first installed NVM and then Node (which installed NPM for me) I couldn't understand why running npm -g ls shows lots of different modules which, after looking them up on the NPM registry, look to be very basic helpers and boilerplate modules which other more advanced modules build on. Here is the entire list of modules it prints out:

unknownd8a25e8b001d:~ [username]$ npm -g ls
/Users/[username]/.nvm/v0.10.18/lib
└─┬ npm@1.3.8
  ├── abbrev@1.0.4
  ├── ansi@0.1.2
  ├── archy@0.0.2
  ├── block-stream@0.0.7
  ├── child-process-close@0.1.1
  ├── chmodr@0.1.0
  ├── chownr@0.0.1
  ├── cmd-shim@1.0.1
  ├── editor@0.0.4
  ├── fstream@0.1.24
  ├─┬ fstream-npm@0.1.5
  │ └── fstream-ignore@0.0.7
  ├── github-url-from-git@1.1.1
  ├── glob@3.2.6
  ├── graceful-fs@2.0.0
  ├── inherits@2.0.0
  ├── ini@1.1.0
  ├─┬ init-package-json@0.0.11
  │ └── promzard@0.2.0
  ├── lockfile@0.4.0
  ├── lru-cache@2.3.0
  ├─┬ minimatch@0.2.12
  │ └── sigmund@1.0.0
  ├── mkdirp@0.3.5
  ├── node-gyp@0.10.9
  ├── nopt@2.1.2
  ├─┬ npm-registry-client@0.2.28
  │ └── couch-login@0.1.18
  ├── npm-user-validate@0.0.3
  ├─┬ npmconf@0.1.2
  │ └─┬ config-chain@1.1.7
  │   └── proto-list@1.2.2
  ├── npmlog@0.0.4
  ├── once@1.1.1
  ├── opener@1.3.0
  ├── osenv@0.0.3
  ├─┬ read@1.0.5
  │ └── mute-stream@0.0.4
  ├── read-installed@0.2.3
  ├─┬ read-package-json@1.1.1
  │ └─┬ normalize-package-data@0.2.1
  │   └── github-url-from-git@1.1.1
  ├─┬ request@2.25.0
  │ ├── aws-sign@0.3.0
  │ ├── cookie-jar@0.3.0
  │ ├── forever-agent@0.5.0
  │ ├─┬ form-data@0.1.0
  │ │ ├── async@0.2.9
  │ │ └─┬ combined-stream@0.0.4
  │ │   └── delayed-stream@0.0.5
  │ ├─┬ hawk@1.0.0
  │ │ ├── boom@0.4.2
  │ │ ├── cryptiles@0.2.2
  │ │ ├── hoek@0.9.1
  │ │ └── sntp@0.2.4
  │ ├─┬ http-signature@0.10.0
  │ │ ├── asn1@0.1.11
  │ │ ├── assert-plus@0.1.2
  │ │ └── ctype@0.5.2
  │ ├── json-stringify-safe@5.0.0
  │ ├── mime@1.2.10
  │ ├── node-uuid@1.4.0
  │ ├── oauth-sign@0.3.0
  │ ├── qs@0.6.5
  │ └── tunnel-agent@0.3.0
  ├── retry@0.6.0
  ├── rimraf@2.2.2
  ├── semver@2.1.0
  ├─┬ sha@1.2.1
  │ └── readable-stream@1.0.2
  ├── slide@1.1.4
  ├── tar@0.1.18
  ├── uid-number@0.0.3
  └── which@1.0.5

So my question is, does NPM install various global modules for its own use when it is installed? It does look, from the indenting, as though these are modules npm uses because they're nested underneath npm@1.3.8 and with Finder I can see how NPM looks to have these within its own node_modules folder.

Problem courtesy of: Glen Selle

Solution

The Node Package Manager (NPM) itself is a module, which yes, does have dependencies. Therefore the answer to your question is yes, except that the modules are installed as dependencies, not globally. The module NPM itself is the global module.

Solution courtesy of: hexacyanide

Discussion

There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.