I'm running Node 6.3.0 on a MackBook I just set up running OS X 10.11
我正在运行OS X 10.11的MackBook上运行Node 6.3.0
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.
我使用Homebrew安装了Node,我注意到当我运行npm install时,它会安装数十个额外的软件包。
For instance when I run npm install gulp --save
it installs gulp but when I look in the node_modules
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.
例如,当我运行npm install gulp --save时,它会安装gulp但是当我查看node_modules目录时,我会看到30或40个额外文件夹。这与我在Linux机上运行npm时不同。当我这样做时,我只看到一个目录。
Am I doing something incorrectly?
我做错了什么吗?
1 个解决方案
#1
1
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 depends on B and B depends on C it would look like this:
您可能在Linux机器上使用旧版本的npm(<3)。使用npm 3,他们改变了存储依赖关系的方式,并尝试压缩依赖关系树。例如如果你有一个依赖于B和B依赖于C的项目A,它将如下所示:
npm 2:
npm 2:
A/node_modules/B/node_modules/C
npm 3:
npm 3:
A/node_modules/B
A/node_modules/C
Hope this helps.
希望这可以帮助。
#1
1
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 depends on B and B depends on C it would look like this:
您可能在Linux机器上使用旧版本的npm(<3)。使用npm 3,他们改变了存储依赖关系的方式,并尝试压缩依赖关系树。例如如果你有一个依赖于B和B依赖于C的项目A,它将如下所示:
npm 2:
npm 2:
A/node_modules/B/node_modules/C
npm 3:
npm 3:
A/node_modules/B
A/node_modules/C
Hope this helps.
希望这可以帮助。