Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'gulp' is not recognized as an internal or external command

Tags:

node.js

gulp

I am trying to use Gulp and Node.Js to stream my process for minifying and concatenating CSS/JS files for production.

Here is what I have done.

  1. I installed Node.Js on my Windows 7 machine.
  2. Installed Gulp globally using this command npm install -g gulp
  3. Then I added a new User variable called NODE_PATH set it to %AppData%\npm\node_modules

After closing and re-opening my command line, I tried to run a gulp task from the command line (i.e. gulp css). But that give me the following error

'gulp' is not recognized as an internal or external command 

How can I get this to work?

When I opened the following path using the search bar in windows, %AppData%\npm\node_modules I see the following two folders

gulp gulp-cli 

enter image description here

I've tried to add %AppData%\npm\node_modules to the Path variable on my system variable, but it did not take it because that variable reached it's max allowed character limit.

I removed couple of paths from my Path variable and added ;C:\Users\[MyWindowsUserName]\AppData\Roaming\npm\node_modules

but still not working.

I even tried to set the path at run time using this command

PATH=%PATH%;C:\Users\[MyWindowsUserName]\AppData\Roaming\npm\node_modules then run gulp and still the same issues.

What am I missing here? What else do I need in order to get this to work?

like image 831
Junior Avatar asked Aug 28 '16 19:08

Junior


People also ask

How do you fix error gulp is not recognized as an internal or external command?

To solve the error "'gulp' is not recognized as an internal or external command, operable program or batch file", install the gulp-cli package globally by running npm install -g gulp-cli , restart your terminal and make sure your PATH environment variable is set up correctly.

How do I install gulp?

To install Gulp locally, navigate to your project directory and run npm install gulp . You can save it to your package. json dependencies by running npm install gulp --save-dev . Once you have Gulp installed locally, you can then proceed to create your gulpfile.

How do I install gulp on Windows 10?

To install Gulp, open the terminal in the same directory you created the gulpfile. js file and run npm i gulp --save-dev , once it has finished running type gulp talktome in to the command line. Hello From Zestcode should appear in the terminal. If it does, congratulations!

How do I know if gulp is installed?

First run npm -g install gulp-cli then run gulp -v. Alternatively, you can just run npm list gulp.


2 Answers

I had similar issue when I installed locally initially(w/o -g). I reinstalled with -g (global) and then it worked.

npm install -g gulp 

you should run gulp from folder where gulpfile.js is available.

like image 61
tomcat Avatar answered Sep 29 '22 14:09

tomcat


I solved the problem by uninstalling NodeJs and gulp then re-installing both again.

To install gulp globally I executed the following command

npm install -g gulp 
like image 35
Junior Avatar answered Sep 29 '22 13:09

Junior