NPM包目录混乱

时间:2015-12-04 08:26:06

标签: json node.js gruntjs npm

前一段时间,当我在我的项目下运行npm install时,通过安装我在packages.json文件下定义的所有软件包,它正确安装了所有节点模块。

现在我已将npmnode更新为最新版本,当我运行npm install时,npm软件包的90%子目录将安装在node_modules文件夹下。因此看起来会很混乱。这里是文件夹的图片:(由于分辨率有限,我无法获取所有文件夹)

enter image description here

这是我的package.json文件:

{
  "name": "my-application",
  "description": "description here...",
  "repository": {
    "type": "git",
    "url": ""
  },
  "version": "0.0.1",
  "devDependencies": {
    "grunt": "~0.4.1",
    "grunt-autoprefixer": "~0.4.0",
    "grunt-bower-install": "~0.7.0",
    "grunt-concurrent": "~0.4.1",
    "grunt-connect-proxy": "~0.2.0",
    "grunt-connect-socket.io": "^0.7.1",
    "grunt-contrib-clean": "~0.5.0",
    "grunt-contrib-coffee": "~0.7.0",
    "grunt-contrib-compass": "~1.0.1",
    "grunt-contrib-concat": "~0.3.0",
    "grunt-contrib-connect": "~0.11.2",
    "grunt-contrib-copy": "~0.4.1",
    "grunt-contrib-cssmin": "~0.7.0",
    "grunt-contrib-htmlmin": "~0.1.3",
    "grunt-contrib-imagemin": "~0.3.0",
    "grunt-contrib-jshint": "~0.7.1",
    "grunt-contrib-uglify": "~0.2.0",
    "grunt-contrib-watch": "~0.5.2",
    "grunt-fixmyjs": "0.2.0",
    "grunt-google-cdn": "~0.2.0",
    "grunt-karma": "~0.6.2",
    "grunt-newer": "~0.5.4",
    "grunt-ngmin": "~0.0.2",
    "grunt-rev": "~0.1.0",
    "grunt-usemin": "~2.0.0",
    "jasmine": "~2.3.1",
    "jshint-stylish": "~0.1.3",
    "jshint-stylish-ex": "^0.2.0",
    "karma": "~0.10.8",
    "karma-chrome-launcher": "~0.1.1",
    "karma-coffee-preprocessor": "~0.1.1",
    "karma-firefox-launcher": "~0.1.2",
    "karma-html2js-preprocessor": "~0.1.0",
    "karma-jasmine": "~0.1.5",
    "karma-ng-html2js-preprocessor": "~0.1.0",
    "karma-ng-scenario": "~0.1.0",
    "karma-phantomjs-launcher": "~0.1.1",
    "karma-requirejs": "~0.2.0",
    "karma-script-launcher": "~0.1.0",
    "load-grunt-tasks": "~0.2.0",
    "requirejs": "~2.1.9",
    "socket.io": "~1.3.7",
    "socket.io-client": "^1.3.7",
    "time-grunt": "~0.2.1"
  },
  "engines": {
    "node": ">=0.8.0"
  },
  "scripts": {
    "test": "grunt test"
  }
}

如何告诉npm正确安装/安排目录?

NPM版本:3.5.0 节点版本:5.1.0

我使用grunt来运行项目。

1 个答案:

答案 0 :(得分:2)

对于npm 3,您的依赖项现在将默认安装为平面。如果可能,所有依赖项及其依赖项及其依赖项将安装在项目的node_modules文件夹中,而不进行嵌套。仅当两个或多个模块具有冲突的依赖关系时才会发生嵌套。

这样做是因为在窗口中存在对最大路径长度的限制。