我一直在遵循 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"
}
}
最佳答案
这是由于新的 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.
关于node.js - 当 npm 在本地项目中安装 GULP 时 - 我在 node_modules 中得到大量文件夹 - 为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34294308/