Oliver Watkins
Oliver Watkins

Reputation: 13489

Cannot install and run gulp via npm

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.. :(

Upvotes: 2

Views: 12584

Answers (3)

Matt
Matt

Reputation: 1038

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).

Upvotes: 3

Christophe
Christophe

Reputation: 4828

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

Upvotes: 3

Merott
Merott

Reputation: 7369

You need to install gulp globally too:

npm -g install gulp

Upvotes: 7

Related Questions