a blog for those who code

Tuesday 14 April 2015

How to solve : No gulpfile found

In this post we are going to discuss about how to solve no gulpfile found error. In our previous post we have explained about Configuring System for using TypeScript where we have explained how to install gulp (A JavaScript Task Runner).

Now after installing gulp using npm install gulp -g when you run gulp in the command line you might get an error as No gulpfile found error.


This error means that gulp doesn't find gulpfile.js to follow the instructions. To solve this error we simply need to add gulpfile.js to our directory root by running the command

touch gulpfile.js

Now after adding gulpfile.js if we run gulp command again we will get a new error, Task 'default' is not in your gulpfile, as shown below.


The above error means that we do not have a default task in our gulpfile.js. Every gulpfile needs a default task to run when gulp is executed without any arguments. So we are going to add a default task in our gulpfile.

var gulp = require('gulp');
gulp.task('default', function () { console.log('Hello Gulp!') });

Now when we run the gulp command we get the following output. Thus our gulp process is up and running.


Please Like and Share the CodingDefined.com Blog, if you find it interesting and helpful.

15 comments:

  1. Thanks. I was breaking my head on this - didn't know the file has to be named in a certain way (gulpfile.js) - thanks much.

    ReplyDelete
  2. Thanks
    Working great

    ReplyDelete
  3. That was cristal clear. Thanks so much!

    ReplyDelete
  4. gulp.js = No go. gulpfile.js = Everythings just fine.

    Thanks!

    ReplyDelete
  5. Thank you. That helped me to get started with gulp :)

    ReplyDelete
  6. Thank. This was helpful.

    ReplyDelete
  7. getting error "'touch' is not recognized as an internal or external command,
    operable program or batch file."

    ReplyDelete
    Replies
    1. getting error "'touch' is not recognized as an internal or external command
      did u resolve it...? Even m getting the same error

      Delete
    2. create the file by yourself that gonna work

      Delete
  8. it didn't work still getting the error Task 'default' is not in your gulpfile . I have a default task set in gulp.js but still ....

    ReplyDelete