15

I'm completely new to Gulp but I wanted to try it out. Due to restrictions/admin rights on my desktop and moving about a lot, I need things portable, and so am currently running everything I need off a stick.

I've browsed similar posts but none of the solutions seemed to solve the problem I'm having.

I used the following commands in cmd with Ruby to install gulp -

npm install -g gulp

and then

npm install --save-dev gulp

I'm seeing the folders and files, but when I run gulp -v in cmd I get the following:

" 'gulp' is not recognized as an internal or external command, operable program or batch file."

I'm not sure if this is a problem related to the fact I don't have admin rights for this computer or not. Any help so I can troubleshoot further would be much appreciated!

E:\xampp\htdocs\wordpress>PATH
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32
\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\;C:\RailsInstaller\Git\cmd;C:\R
ailsInstaller\Ruby1.9.3\bin

Thanks

fredyfx
  • 403
  • 10
  • 22
mkultron
  • 303
  • 1
  • 2
  • 10

7 Answers7

24

My Full Response

Solution

  1. Re-download nodejs
  2. npm install -g gulp
  3. gulp -version
Community
  • 1
  • 1
christo8989
  • 6,442
  • 5
  • 37
  • 43
10

I had the same problem when I installed gulp, I was not able to run gulp in command line. I was getting the following error:

'gulp' is not recognized as an internal or external command, operable program or batch file.

After doing some re-search I found that I needed to update the Path variable. Following is the command you can run in command line to add the path to the system path variable.

C:\> PATH=%PATH%;C:\Users\**<username>**\AppData\Roaming\npm
fredyfx
  • 403
  • 10
  • 22
Sandeep
  • 101
  • 1
  • 2
2

Using VS2017, Net CORE 1.1 I received this error. I ran the following in a command window at the root of my project:

cmd.exe /c gulp --tasks-simple 

This showed me the real error in a stack trace: there was a typo in my gulpfile.js.

So for me the problem was a simple typo and had nothing to do with gulp, npm or installation.

reformed
  • 4,505
  • 11
  • 62
  • 88
RichyRoo
  • 373
  • 3
  • 10
  • Thanks so much for this answer! After running the command it was revealed I needed to rebuild node-sass. The VS error alone would _never_ have led me to that. – Orion Jan 19 '18 at 16:37
1

Seems that you didn't configured the /bin folder of your node installation in the PATH variable, however in windows it should be done automatically. The PATH in your question refers to C:\Program Files\nodejs. You can add the environment variable manually or download the latest version and try again.

For those using linux, (if downloaded the Linux Binaries (.tar.xz)) please add, in your home (~/.bashrc), the export of node's bin folder, like:

    export PATH=$PATH:/opt/node/bin
mauriciovigolo
  • 296
  • 4
  • 6
1

1- Check Is NPM Global installer installed the gulp or other package what you looking for the default path is "C:\Users\YOUR_USER\AppData\Roaming\npm"

If the gulp executable on there you have installed it globally. If not install it globally. Like above right:

npm install -g gulp

2- Add it to windows environment system variables like that to working with it on your local IDE

NODE_PATH %AppData%\Roaming\npm\node_modules
GULP_PATH %AppData%\AppData\Roaming\npm
NPM_PATH %AppData%\AppData\Roaming\npm   <- one of them 
Hamit YILDIRIM
  • 4,224
  • 1
  • 32
  • 35
0

If someone is having this issue with an npm script that uses gulp, and with gulp as a dev dependency in your package.json, you shouldn't need to install gulp globally, I fixed it by doing a clean install.

npm ci

-2

It sounds like theres some information missing, and while Im a bit confused about the 'commands in cmd with Ruby' this might set you down the right path.

After you install Gulp globally, as you did; npm install -g gulp, you want to cd into your project root and npm install gulp --save-dev. This is all outlined in this article, which is recommended alongside some other getting started articles by Gulp.

mw_
  • 37
  • 3
  • Thanks mw_. I tried again but still "gulp -v" gives me that error. I thought perhaps it may be down to the ordering of the local install as I noticed yours differed from mine slightly, but no luck as yet. – mkultron Jan 14 '15 at 13:18
  • Hmmm. Check that your environment and path are setup correctly. I came across [a similar question](http://stackoverflow.com/questions/19135561/grunt-on-windows-8-grunt-is-not-recognized), and it looks like there's a few solutions worth exploring. – mw_ Jan 15 '15 at 03:29
  • Thanks mw_. I'm getting the "INFO: Could not find files for the given pattern(s)." message when I try "where gulp". I ran "PATH" in cmd and have got this back (see edit in original post). Not really sure what I'm looking at but I'm guessing "C:\Users\Username\AppData\Roaming\npm\" should feature in the response. I wonder if it's because I installed Gulp on my stick and/or my lack of admin rights for the machine I'm using. – mkultron Jan 15 '15 at 11:45
  • Im on OSX so Windows it out of my "area". Have a look at that link in my last comment again, and make sure your `NODE_PATH` bit is correct. Im not really sure where to go from here, but I know it involves getting your environment correctly configured. I don't think the stick (you mean USB right?) is going to be the way to go, so maybe consider creating a folder on the machine, and install everything fresh??? – mw_ Jan 16 '15 at 01:31
  • Yeah, so you make OP install gulp globally and then install it locally, what's the point? – DevAntoine Sep 01 '15 at 15:47
  • "Yeah", I didn't make OP install anything. I was trying to help by pointing him to the article referenced. Your right about 'the point', I was thinking the same thing regarding your helpful comment. – mw_ Sep 01 '15 at 16:58