Showcaselfloyd Showcaselfloyd - 1 year ago 98
Node.js Question

How do I get NPM install just one package?

I'm running Node 6.3.0 on a MackBook I just set up running OS X 10.11

I installed Node using Homebrew and I noticed that when I run

npm install
it installs what amounts to dozens and dozens of extra packages.

For instance when I run
npm install gulp --save
it installs gulp but when I look in the
directory I see what looks like 30 or 40 extra folders. This is different then when I run npm at home on my Linux box. When I do that I only see the one directory.

Am I doing something incorrectly?

Answer Source

You are probably using an older version of npm (< 3) on your Linux box. With npm 3 they changed the way they store dependencies and try to flatten the dependencies tree. e.g. If you had a project A that requires B and that requiring B it would look like this:

npm 2:


npm 3:


Hope this helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download