Monday, August 22, 2016

Gulp fails on new Visual Studio project, and does not see tasks

So you decide to give the new yet powerful 'Gulp' tool a try and fire up the Visual Studio 2015 IDE. You follow a basic tutorial or document to create a simple Hello World application. Next, you might create the gulpfile.js and define a couple of tasks to automate. Happy with your quick Gulp example project, you execute your project, and get an error.

Error 1

If the error you get is something like below:

cmd.exe /c gulp --tasks-simple
'gulp' is not recognized as an internal or external command,
operable program or batch file.

then, this is what may help you:

  1. Install the latest Node.js from . I installed v4.5.0 as of writing.
  2. Next, open your Windows Command Prompt
  3. Type node -v and hit enter. If you see the version shown then Node is now installed.
  4. Next type on the command prompt: C:\Users\Saurabh>npm install -g gulp
  5. This should now install Gulp on your machine ready for use in your project

Error 2

If the error you get is something like below, where your Task Runner Explorer is not able to see any Gulp tasks and gives "No tasks found" error:

For this error to go away,
  1. Open Command Prompt
  2. Go to the folder of your project, and enter command npm install gulp
  3. Press enter to execute
  4. Now, if you refresh your Task Runner, it should load the tasks