Cannot install and run gulp via npm

10,574

Solution 1

You need to install gulp globally too:

npm -g install gulp

Solution 2

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

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

Share:
10,574
Oliver Watkins
Author by

Oliver Watkins

Over 12+ years experience in Java, 8+ years experience in Swing. Significant Javascript/HTML/CSS/Ajax experience. Also considerable Architecture/Consulting/Coaching/Business Analysis skills Please visit my website : http://www.frontangle.com http://www.blue-walrus.com https://github.com/oliverwatkins

Updated on June 15, 2022

Comments

  • Oliver Watkins
    Oliver Watkins almost 2 years

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