2

I am trying to install gulp via npm so that I can run my project.

As far as I can tell, all I need to do is run "npm install gulp" from the command line of my project location like so :

enter image description here

However it doesn't seem to work, because if I run "gulp" from the command line nothing happens.

enter image description here

In my package.json file I have these dependencies :

  "devDependencies": {
    "autoprefixer-stylus": "^0.7.1",
    "browser-sync": "^2.8.2",
    "gulp": "^3.9.0",
    "gulp-cache": "^0.3.0",
    "gulp-concat": "^2.6.0",
    "gulp-if": "^1.2.5",
    "gulp-imagemin": "^2.3.0",
    "gulp-minify-html": "^1.0.4",
    "gulp-nunjucks-html": "^1.2.2",
    "gulp-order": "^1.1.1",
    "gulp-plumber": "^1.0.1",
    "gulp-stylus": "^2.0.6",
    "gulp-uglify": "^1.2.0",
    "gulp-util": "^3.0.6",
    "jeet": "^6.1.2",
    "kouto-swiss": "^0.11.13",
    "minimist": "^1.1.3",
    "rupture": "^0.6.1"
  },

Is there some kind of conflict happening with my package.json file?

If I run "npm install grunt" from an empty directory I get this :

enter image description here

Sorry, I'm very new to npm, grunt, gulp etc.. :(

Oliver Watkins
  • 10,301
  • 19
  • 83
  • 168

3 Answers3

6

You need to install gulp globally too:

npm -g install gulp
Merott
  • 6,527
  • 6
  • 32
  • 50
3

Install globally and make sure it is in your path. here is more info -> https://stackoverflow.com/a/24042936/173234

Community
  • 1
  • 1
Christophe
  • 4,642
  • 5
  • 39
  • 82
3

This is a combo of understanding npm and PATH settings. When you run npm install gulp, or npm install in general, it installs that module inside of the current directory under the node modules directory. So if you are in C:\Oliver\test and you run npm install gulp, it will install gulp in C:\Oliver\test\node_modules\gulp. Since the PATH variable, which is a variable that contains a list of directories to look up executables (like gulp), doesn't specify the C:\Oliver\test\node_modules\gulp directory, it will never find the gulp command. To solve this, you need to use the npm install -g command where the -g flag specifies a global install, which means it puts it somewhere that is available in the PATH (I'm not sure where this is on Windows).

Matt
  • 787
  • 8
  • 20