13

Started getting this random error when I started a new project and made a new gulpfile.

I get it whenever I run gulp. It isn't just on this project it has started happening on all other projects.

I have read that there might be an issue with environment variables so I have updated these.

I have also recently ran the ruby installer.

Screenshot below shows my environment variables:

enter image description here I'm at a deadend.. Would appreciate some help.

Cheers

Update - Full Error message after running gulp:

gulp : The term 'gulp' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + gulp + ~~~~ + CategoryInfo : ObjectNotFound: (gulp:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

MaxwellLynn
  • 880
  • 5
  • 23
  • 46
  • I have set the path in the variables myself. As I read this is somethign you need to do. any ideas how to fix? – MaxwellLynn Apr 01 '17 at 11:17
  • Revert it to the original `path` and add the path to ruby to the end of the original path. – Sulthan Apr 01 '17 at 11:20
  • I didn't have a path before. So I tried deleting it and it is still in the same condition :O – MaxwellLynn Apr 01 '17 at 11:21
  • Yeah so I've tried deleting it and doing a restart to my machine to see if it is effected. I have also tried removing the node variable as well just incase. Seem to still be getting the same problem though. – MaxwellLynn Apr 01 '17 at 11:29
  • Possible duplicate of [gulp command not found - error after installing gulp](https://stackoverflow.com/questions/24027551/gulp-command-not-found-error-after-installing-gulp) – GolezTrol Sep 17 '18 at 10:23

7 Answers7

27

In my case it was that I had to install gulp-cli by command npm -g install gulp-cli (also I had to install gulp localy in project)

Skylin R
  • 2,111
  • 1
  • 20
  • 23
8

I know this is a bit late to answer this question but who knows someone else might need it too. All you need to do is install gulp globally: npm install gulp -g and it will work just fine

Dilini Peiris
  • 446
  • 1
  • 6
  • 16
beginerTikoo
  • 81
  • 1
  • 2
  • 1
    Apparently running `npm install gulp --save-dev` is not sufficient, it really needs to be installed as a global package `npm install gulp -g` – DarkLite1 Feb 03 '20 at 08:22
5

Since gulp is a dev dependency, it should not be installed globally,instead run inside of your project npm install gulp --save-dev and to run gulp run npx gulp which will run your gulpfile. enter image description here

Suraj Modi
  • 61
  • 1
  • 1
0

I ran into this issue when I updated to the newest version of NPM. I reinstalled Node to version 6.11 and all my problems were solved. I was running Node 8.1 previously.

Node Downloads Page: https://nodejs.org/en/download/

If you go this route, ensure that the installer will add the necessary routes to your machine's path.

Node Installer - Add to Path

Sam Lindstrom
  • 59
  • 1
  • 12
0

I too get that same issue sometimes. It got solved by below steps. It might get solved with 1st step itself sometimes.

  1. Uninstall and install both node and gulp(global and local)

  2. Run npm config rm proxy

  3. Run npm config set registry http://registry.npmjs.org/

  4. Check path variables. Type environment variables in Windows and edit it to your installed path.

0

Mine got solved with these 2 lines:

npm -g install gulp

then

npm -g install gulp-cli

I also installed both gulp and gulp-cli locally (i.e. inside the project):

npm install gulp gulp-cli

and all worked.

I think Gulp needs GLOBAL installation before it will work

fruitloaf
  • 1,628
  • 15
  • 10
0

Install gulp globally:

npm install gulp -g

Install gulp locally inside your project folder:

npm install gulp --save-dev

After doing both, I still got the same error when I straight-up run gulp commands, but they run when my command includes npx, like so:

npx gulp
npx gulp trust-dev-cert
npx gulp serve
Don Brody
  • 1,689
  • 2
  • 18
  • 30