node.js - 当 npm 在本地项目中安装 GULP 时 - 我在 node_modules 中得到大量文件夹 - 为什么?

标签 node.js npm gulp

我一直在遵循 CSS 技巧的 Gulp 安装 - https://css-tricks.com/gulp-for-beginners/我注意到,当我到达他们的文件夹时,应该在 node_module 文件夹中拍摄内容......他们只有 bin 和 gulp。我有 40 多个要添加的文件夹。 这会发生吗? Gulp 需要这些依赖吗?如果不是,为什么会发生这种情况? 这是我的 package.json,其中包含发出的某些信息以及安装时创建的 1/2 文件夹的屏幕截图。我干净地启动项目(没有完成文件夹或疯狂的安装卸载)。

{
  "name": "---",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+-----.git"
  },
  "keywords": [
    "---",
    "---'",
    "---",
    "---"
  ],
  "author": "-----",
  "license": "ISC",
  "homepage": "------",
  "devDependencies": {
    "gulp": "^3.9.0"
  }
}

enter image description here

最佳答案

这是由于新的 npm 3 中的更改所致,我假设您在这里使用的是它(如果您想确定的话,可以通过执行 npm -v 进行检查)。所有模块及其依赖项现在都位于/node_modules 中,而不是嵌套在依赖于它们的模块的子文件夹中(像以前一样)。

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.

来源:http://dailyjs.com/2015/06/26/npm-3/

关于node.js - 当 npm 在本地项目中安装 GULP 时 - 我在 node_modules 中得到大量文件夹 - 为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34294308/

相关文章:

node.js - 安装sqlite3时node-pre-gyp出错

javascript - 无法在 TypeScript 中导入 NPM 包(例如 Faker)

javascript - 从 reviver 访问 JSON 对象中的数组

css - 如果指定字体格式,字体将不起作用

macos - 如何在 mac os x 上安装旧版本的 TypeScript?

javascript - 具有动态名称的文件夹的压缩内容

javascript - 使用 Gulp-mocha : "Window is not Defined" 测试 Angular

javascript - Gulp 断言错误 [ERR_ASSERTION] : Task function must be specified after Node and NPM update

node.js - 更改 Node 支持网站前端使用的脚本文件

javascript - Node.js - 使用 'async' 和 'await' 进行后续 ORM