简体   繁体   English

npm不仅加载我在package.json中清除的软件包

[英]npm loads not only my packages decleard in package.json

I'm working on a small project using npm, bower and grunt. 我正在使用npm,bower和grunt进行一个小项目。 When I do an "npm install" on my PC, its loading a lot wired stuff (see screenshot). 当我在PC上进行“ npm安装”时,它会加载大量有线内容(请参见屏幕截图)。 But when I do the same on my MBA its loading only my declared packages: 但是,当我在MBA上执行同样的操作时,它仅加载声明的包:

{
  "private": true,
  "devDependencies": {
    "grunt": "^0.4.5",
    "grunt-grunticon": "^2.2.2"
  }
}

node_modules文件夹

npm3 (which is used by default since Nodev5) flattens the dependency tree. npm3(自Nodev5起默认使用)将展平依赖关系树。 You may still be using npm2 (which doesn't do that) on the other system. 您可能仍在其他系统上使用npm2(不这样做)。

From the changelog : 变更日志

Flat, flat, flat! 平,平,平!

Your dependencies will now be installed maximally flat. 现在,您的依赖项将最大程度地平面安装。 Insofar as is possible, all of your dependencies, and their dependencies, and THEIR dependencies will be installed in your project's node_modules folder with no nesting. 在可能的情况下,所有依赖项及其依赖项和THEIR依赖项都将安装在项目的node_modules文件夹中,而不会嵌套。 You'll only see modules nested underneath one another when two (or more) modules have conflicting dependencies. 当两个(或更多)模块具有相互依赖的依赖关系时,您只会看到模块彼此嵌套。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM