remid
remid

Reputation: 15

Install and gulp plugins

I have a little trouble while installing Gulp.

In my gulpfile.js I have these require:

var gulp = require('gulp');
var sass = require('gulp-sass');
var browserSync = require('browser-sync');
var del = require('del');
var notify = require("gulp-notify");
var htmlExtended = require("gulp-html-extend");
var imagemin = require('gulp-imagemin');
var pngquant = require('imagemin-pngquant');
var bower = require('gulp-bower');

And in my package I have my Dependencies:

{
  "name": "PROJECT",
  "version": "0.0.1",
  "private": true,
  "devDependencies": {
    "browser-sync": "^2.11.0",
    "del": "^1.2.0",
    "gulp": "^3.9.0",
    "gulp-bower": "^0.0.11",
    "gulp-html-extend": "^1.1.4",
    "gulp-imagemin": "^2.3.0",
    "gulp-load-plugins": "^1.0.0-rc.1",
    "gulp-notify": "^2.2.0",
    "gulp-sass": "^2.0.1",
    "imagemin-pngquant": "^4.2.0",
    "lodash": "^3.9.3"
  },
  "scripts": {
    "install": "bower install"
  }
}

The problem is when I start a npm install or npm install --save-dev it installs tons of plugins I didn't ask for. Here is my "node_modules" folder after the installation:

Too many gulp plugins

How do I install only the plugins I asked for in my package.json?

Upvotes: 1

Views: 559

Answers (1)

Mario Tacke
Mario Tacke

Reputation: 5488

Looks like you are running npm version 3. In version 3, npm changed to have all child dependencies in the top level folder under node_modules. In version 2, npm had a module's child dependencies in another node_modules folder.

To make sure you do not have unnecessary items in that folder, remove all folders within node_modules and run npm install again. This will flush out any folders that have not been added to package.json.

By the way, you can check your npm version with npm -v or npm --version while within your project folder.

Sample npm 2 folder structure:

README.md
node_modules/
    dependency_a/
        node_modules/
            dependency_of_a/
package.json

Sample npm 3 folder structure:

README.md
node_modules/
    dependency_a/
    dependency_of_a/
package.json

Upvotes: 1

Related Questions