Reputation: 71991
I'm new to npm
, but whenever I run npm install
on any node based project I get on github, it seems like it seriously runs for about 1 minute at least, no matter how simple the package.json is, and scrolls hundreds, if not thousands of lines like this by in the console...
npm http 304 https://registry.npmjs.org/string_decoder
npm http 304 https://registry.npmjs.org/isarray
npm http GET https://registry.npmjs.org/depd
npm http 304 https://registry.npmjs.org/depd
npm http GET https://registry.npmjs.org/xtend
npm http 304 https://registry.npmjs.org/xtend
npm http GET https://registry.npmjs.org/js-base64
npm http GET https://registry.npmjs.org/source-map
npm http 304 https://registry.npmjs.org/source-map
...
I assume these must be dependencies of the modules that are being installed? If so, are they being installed locally for this project? and is there a way to make it so these dependency type lookups are stored only once on my machine, to save space and decrease the amount of time this process takes?
Upvotes: 1
Views: 212
Reputation: 106696
To answer your questions:
Yes those are dependencies being installed.
Modules are installed locally unless you add -g
to the command line (although adding this argument should really only be done for modules that mainly provide command-line tools that you execute at your shell prompt).
They are cached. When npm queries the registry, it uses special headers to ask the registry if the cached copy is outdated or not. The 304
in the output is the http status code of the module query request. So the registry here is telling us that these modules are not outdated and that the locally cached copies can be used.
Upvotes: 1